简体   繁体   中英

IIS 8 Rewrite rule gives me 404 error

I used following Rewrite rule on IIS 8 for asp.net application. But it gives me 404 error when I try to access www.mysiteurl.com/?_escaped_fragment_. If I change actionType to Redirect it redirect successfully.

<rule name="Prerender" stopProcessing="true">
          <match url="^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.woff|\.woff2|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*)" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_USER_AGENT}" pattern="baiduspider|facebookexternalhit|twitterbot" />
            <add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" />
          </conditions>
          <action type="Rewrite" url="http://service.prerender.io/http://{HTTP_HOST}/{R:0}" />
        </rule>

But If I set action URL to resource inside the same server it works. As I feel the issue happens because it redirect to another domain.
Are there any specific setting on IIS to enable diferent domain Rewrite? What could be the problem ?

After doing research I found out the solution for this. Installing Application Request Routing to the IIS and enable proxy solved my problem.

Hope this would help to some one :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM