URL Rewrite keeps original host Location when reverse proxy 301 redirects

前端 未结 2 642
悲&欢浪女
悲&欢浪女 2020-12-05 15:14

I have URL Rewrite setup on an IIS 7.5 site: http://site1.com/

This acts as a reverse proxy to the second site: http://site2.com/

Here is the flow of events:

2条回答
  •  眼角桃花
    2020-12-05 15:19

    As I said in the above comments, I believe the default behavior of the reverse proxy is to pass through the response untouched (assumes there are no outbound rewrite rules set). I haven't tested your scenario specifically with a 301 response from the server behind the proxy, though.

    If a special outbound rule is in fact needed, this code will modify the HTTP location header of all 301 responses to http://site3.com/somepath

    
      
      
        
        
          
        
        
      
    
    

    This rule is a slight modification of one posted in URL Rewrite Module 2.0 Configuration Reference

提交回复
热议问题