nginx可以很方便的配置成反向代理服务器,但如果使用的不是默认的80端口,转发请求时有可能会丢失端口号,这里只要在$host后面加上:$server_port;即可,例如:
server {
listen 9000;
server_name 10.130.161.16;
location ^~ /test-idworker/ {
proxy_pass http://testWorkerDev;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}