I am trying to setup URL rewriting to rewrite all references to images, etc. to point to my CDN.
I have it working on any reference within the .NET pages using the following web.config settings:
<outboundRules>
<rule name="Outbound CDN: fonts" preCondition="IsTextContent">
<match filterByTags="None" pattern="^/fonts/(.+)$" />
<action type="Rewrite" value="http://cdn.mydomain.com{R:0}" />
</rule>
<rule name="Outbound CDN: images" preCondition="IsTextContent">
<match filterByTags="A, Img, Link" pattern="^/images/(.+)$" />
<action type="Rewrite" value="http://cdn.mydomain.com{R:0}" />
</rule>
<rule name="Outbound CDN: pdf" preCondition="IsTextContent">
<match filterByTags="A, IFrame" pattern="^/pdf/(.+)$" />
<action type="Rewrite" value="http://cdn.mydomain.com{R:0}" />
</rule>
<rule name="Outbound CDN: scripts" preCondition="IsTextContent">
<match filterByTags="Script" pattern="^/scripts/(.+)$" />
<action type="Rewrite" value="http://cdn.mydomain.com{R:0}" />
</rule>
<rule name="Outbound CDN: style" preCondition="IsTextContent">
<match filterByTags="Link" pattern="^/style/.+\.(?:css|less|sass|master|cs)$" />
<action type="Rewrite" value="http://mydomain.com{R:0}" />
</rule>
<preConditions>
<preCondition name="IsTextContent">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/(.+)$" />
</preCondition>
</preConditions>
</outboundRules>
However, I can not figure out to rewrite references to the images and fonts referenced within CSS files.
Does anyone have any ideas on how to do a similar URL rewrite for images and fonts referenced within the CSS.
I am using Windows Server 2012R2, IIS 8.5, .NET 4.5.1, and the latest version of the URL Rewrite and Application Request Routing modules.