Nginx proxy application port loss problem
In the process of using Nginx to proxy weblogic recently , it was found that after accessing the console of weblogic , the corresponding port number was automatically lost when the application jumped to the login interface. For example, when I visit http://localhost:8888/console , the address in the address bar automatically changes to http://localhost/console/login/LoginForm.jsp when I jump to the login interface. Obviously, the port number is lost. . My configuration is like this:
server {
listen 8888;
server_name localhost:8888;
#charset koi8-r;
proxy_connect_timeout 300s;
proxy_set_header Host $host;
proxy_set_header Referer $http_referer;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location /emc {
proxy_pass http://localhost:7002;
}
location / {
proxy_pass http://127.0.0.1:7001;
}
location = /50x.html {
root html;
}
}
Pay attention to the line of proxy_set_header Host $host above , where the host does not have a port number, change it to proxy_set_header Host $host:8888 , the problem is solved.