我试图用nginx来实现一个反向代理。 但以上configuration我得到的是在浏览器中的一个错误的url:
http://domain:9080/myLocation/something.html
和我需要的是(没有端口):
http://domain/myLocation/something.html
组态:
location /myLocation { proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://xptoserver:9080$request_uri; }
主机头不应该有一个端口。
改变这个:
proxy_set_header Host $host:$server_port;
对此:
proxy_set_header Host $host;