Nginx proxy port redirect ignore port

2019-09-15 00:41发布

问题:

two nginx  
first nginx:10097->80 port  
second nginx:80 port ->code  

then,code get the request url no port, but if no redirect, the url on browser has port 10097, but if redirect, the port is ignored
is need change nginx proxy port

回答1:

say my point: request arrive first nginx: 10097 port change to 80 port
arrive second nginx : 80 port is default port, be ignored

so, if you want to get the port ,you can modify second nginx like this
it mean pass host and port to code, then you can get port in the code

answer : proxy_set_header Host $http_host;



标签: java nginx