IIS reverse proxy with rewrites can't handle a redirect from the server we proxy to

孤者浪人 提交于 2019-11-29 00:40:10

问题


We own server A, and on some occasions we rewrite requests to our partner on server B.

In some cases server B will respond with a redirect to a completely different website, which is what is expected, let's say server C. However, when that redirect form server B comes back to server A, server A interprets it as a redirect to a location on iteself (A) and not as a redirect to other website - server C.

How do I take note of the redirect to the external website and actually go there, rather than assuming that redirect is on my server (and 404ing)? We're running IIS 7 with the rewrite module.

Any help much appreciated.


回答1:


Go to the ARR proxy settings (they're hidden under IIS -> Application Request Routing Cache -> Server Proxy Settings) and uncheck the "Reverse rewrite host in response headers" checkbox. That should be enough.




回答2:


If you can't change this in the GUI, you can set the config via command line.

Something like this should work:

appcmd.exe set config -section:system.webServer/proxy /reverseRewriteHostInResponseHeaders:"False" -commit:apphost



回答3:


The "Reverse rewrite host in response headers" checkbox was in a different place for me. I'm using Windows Server 2012 R2.

It was under Connections -> Server Farms -> -> Proxy, just below the time-out settings.

In my case, checking this resolved my issues.



来源:https://stackoverflow.com/questions/4243959/iis-reverse-proxy-with-rewrites-cant-handle-a-redirect-from-the-server-we-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!