IIS Rewrite not working (but redirection does)

前端 未结 4 442
孤城傲影
孤城傲影 2021-01-03 19:50

I was trying to play with URL re-writing using the Rewrite Module 2.0 but I had no luck getting it to work. What I\'m trying to do is re-write all calls to web app

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 20:50

    I ran into this same issue yesterday, and it took me a long time to figure out.

    The key here is that you've got an http:// prefix in your rewrite action; that makes this a special case that needs to be handled by Application Request Routing. The first step is to make sure that the Application Request Routing module is installed. You can find the module at https://www.iis.net/downloads/microsoft/application-request-routing. Once that is installed, go to your IIS web server (a level up from your web site), and open the Application Request Routing Cache feature. From the actions on the right, choose Server.Proxy.Settings, and make sure that the "Enable Proxy" checkbox is checked. This allows the URL rewrite task to be re-routed to Application Request Routing, and your reverse proxy should work for external requests.

    The idea came from this excellent blog post from 2009: http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/

提交回复
热议问题