Can't configure nginx as a proxy for tomcat with context path

荒凉一梦 提交于 2020-01-14 17:59:07

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!