5

I have been attempting to figure out why this rule works as a redirect and not as a rewrite. It didn't occur to me try it as a redirect until several hours later and to my surprise it worked.

Could you explain why the first one works but the second one doesn't?

Redirect

<rule name="Rewrite to images.cdn.com" enabled="true">
<match url="^images/(.+)$" />
<action type="Redirect" url="http://images.cdn.com/{R:1}"/>
</rule>

Rewrite

<rule name="Rewrite to images.cdn.com" enabled="true">
<match url="^images/(.+)$" />
<action type="Rewrite" url="http://images.cdn.com/{R:1}"/>
</rule>

Failed Request Log information Both the Substitution and rewrite are identical which means it should work since you can copy that url into your browser and it will work.

<EventData>
  <Data Name="ContextId">{00000000-0000-0000-6C00-0080000000F8}</Data>
  <Data Name="Substitution">http://39e403d64323deb9e704-7fcaccb4b31037dfec2feb2a157f55bc.r52.cf1.rackcdn.com/images/updateprogress.gif</Data>
  <Data Name="RewriteURL">http://39e403d64323deb9e704-7fcaccb4b31037dfec2feb2a157f55bc.r52.cf1.rackcdn.com/images/updateprogress.gif</Data>
  <Data Name="AppendQueryString">false</Data>
  <Data Name="LogRewrittenURL">false</Data>
 </EventData>

Thank you!

ASP.NET / IIS 7.0

fseminario
  • 801
  • 1
  • 9
  • 13

1 Answers1

1

The answer can be found at this post: Rewrite Subfolder to Subdomain in web.config

Basically a module was missing and proxy settings needed to be set. Many kudos to @cheesmacfly

Community
  • 1
  • 1
fseminario
  • 801
  • 1
  • 9
  • 13