URL rewrite error - rule works like redirect but not rewrite
I'm trying to figure out why this rule works as a redirect and not as a rewrite. It didn't occur to me to try this as a redirect until a few hours later, and to my surprise it worked.
Could you please explain why the first one works and the second one doesn't?
Redirecting
<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>
Log log error Replacing and rewriting is identical, which means it should work, as you can copy that url to 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!
ASP.NET/IIS 7.0
+3
source to share
1 answer
The answer can be found in this post: Rewrite subfolder to subdomain in web.config
The module was mostly missing and the proxy settings need to be set. Many benefits to @cheesmacfly
0
source to share