Rewriting custom tag attributes using IIS Url Rewrite 2.0 and ARR -
i've developed custom grid control uses data-*
attributes configure how grid supposed work (in similar vein how bootstrap data api components work. particular deployment, i'm having proxy web application web application using iis , application request routing (arr) + url rewrite. proxying part done, i'm trying configure outbound rules rewriting urls match. instance, have rules set such as:
- rewrite http redirects updating
location:
header. - rewrite html content uris in standard tags (e.g., a, area, base, etc.)
- rewrite css content uri's relative (e.g. /cassette.axd -> /blog/cassette.axd).
the last issue having, getting url rewrite module accept urls in data attributes, e.g., if grid such like:
<table data-grid data-query="/api/users/">
should rewritten as
<table data-grid data-query="/blog/api/users/">
i stress other tags, such <a href
, <img src
work expected , custom <property value
tag correctly rewritten. seems hypenated attributes.
i've tried adding <customtags>
section, custom tags in:
<customtags> <tags name="bootgrid"> <tag name="table" attribute="data-query" /> <tag name="table" attribute="data-update" /> <!-- next tag works --> <tag name="property" attribute="value" /> </tags> </customtags>
however, above not matching attributes have hyphen. not sure if solvable or not because can't see in iis configuration set these.
also annoyingly once you've created set of custom tags in iis, can't seem edit them again. :-/
i had same issue, , appears (although not confirmed microsoft) iis cannot handle custom tag contains -
a work around worked me use outbound rule. in example attempting replace data-zoom-image attribute within img tag (you need replace <img <table , data-zoom-image data-query in both "match" , "action"
<rule name="rewriterelativepathscustomtags1" precondition="ishtml" enabled="true"> <match filterbytags="none" pattern="<img ([^>]*)data-zoom-image="(.*?)"([^>]*)>" /> <action type="rewrite" value="<img {r:1}data-zoom-image="your value rewrite i.e /blog{r:2}"{r:3}>" /> </rule> <preconditions> <precondition name="ishtml"> <add input="{response_content_type}" pattern="^text/html" /> </precondition> </preconditions>
hope helps
Comments
Post a Comment