5

I've developed a custom grid control that uses data-* attributes to configure how the grid is supposed to work (in a similar vein to how Bootstrap data API components work. For a particular deployment, I'm having to proxy my web application into another web application using IIS and Application Request Routing (ARR) + URL Rewrite. The proxying part is all done, I'm currently trying to configure the outbound rules for rewriting urls to match. For instance, I currently have rules set up such as:

  • Rewrite HTTP redirects by updating the Location: header.
  • Rewrite Html content for URIs in standard tags (e.g., A, Area, base, etc.)
  • Rewrite Css content for URI's that are relative (e.g. /cassette.axd -> /blog/cassette.axd).

The last issue I am having, is getting the URL rewrite module to accept my urls in data attributes, e.g., if my grid is such like:

<table data-grid data-query="/api/users/">

Should be rewritten as

<table data-grid data-query="/blog/api/users/">

I stress that all other tags, such as <a href and <img src work as expected and even a custom <property value tag is correctly rewritten. Just seems to by hypenated attributes.

I've tried adding a <customTags> section, with my custom tags in:

<customTags>
    <tags name="Bootgrid">
        <tag name="table" attribute="data-query" />
        <tag name="table" attribute="data-update" />
        <!-- This next tag WORKS -->
        <tag name="property" attribute="value" />
    </tags>
</customTags>

However, the above is not matching any attributes that have a hyphen. Not sure if this is actually solvable or not because I can't see anything in IIS configuration to set these.

Also annoyingly once you've created a set of Custom Tags in IIS, you can't seem to edit them again. :-/

madth3
  • 7,275
  • 12
  • 50
  • 74
Matthew Abbott
  • 60,571
  • 9
  • 104
  • 129
  • For what it's worth after testing I have the exact same behavior here. Only info I found is this: http://forums.iis.net/t/1162172.aspx/1 – cheesemacfly May 21 '13 at 20:16

3 Answers3

1

I had the same issue, and it appears (although not confirmed by Microsoft) that IIS cannot handle a custom tag that contains a -

A work around that worked for me was to use another outbound Rule. In this example I am attempting to replace the data-zoom-image attribute within an img tag (You will need to replace the &lt;img with &lt;table and data-zoom-image with data-query in both the "match" and "action"

<rule name="RewriteRelativePathsCustomTags1" preCondition="IsHtml" enabled="true">
    <match filterByTags="None" pattern="&lt;img ([^>]*)data-zoom-image=&quot;(.*?)&quot;([^>]*)>" />
    <action type="Rewrite" value="&lt;img {R:1}data-zoom-image=&quotYOUR VALUE TO REWRITE i.e /blog{R:2}&quot;{R:3}>" />
</rule>
<preConditions>
    <preCondition name="IsHtml">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
</preConditions>

Hope this helps

aRJeLA
  • 11
  • 1
1

ARR on IIS seems to have issues with tags that include attributes with a dash (-) in them.

Updating to v3.0.1952 seems to have solved the issue for me, but I'm still investigating.

bharring
  • 11
  • 1
0

Rather belated, but this was fixed back in 2015 in the Release To Web version (2.0.1952):

IMPORTANT - Changes in this release

  • Windows 10 and Windows Server 2016 Support - It is now possible to install URL Rewrite Module 2.0 on Windows 10 or Windows Server 2016 with this release
  • Custom attributes containing dashes are now supported. This is required as HTML 5 has the following rules for determining HTML attribute names: http://www.w3.org/TR/html-markup/syntax.html#syntax-attributes
  • Incorporates Hotfix for URL Rewrite 2.0 (June 2014) as in KB2974666
Zhaph - Ben Duguid
  • 26,785
  • 5
  • 80
  • 117