问题
Having Tomcat with application accessible on http://localhost:8080/application.
Want to have access to this application via url http://app.ru. So here's nginx proxy config:
server {
server_name app.ru .app.ru;
listen 80;
location / {
proxy_pass http://localhost:8080/application;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
When moving to http://app.ru, it return 302 redirect to http://app.ru/application
How to fix it?
回答1:
Thanks for @Richard Smith comment. I've forgotten the trailing slash.
来源:https://stackoverflow.com/questions/37459006/cant-configure-nginx-as-a-proxy-for-tomcat-with-context-path