Answer the question
In order to leave comments, you need to log in
Ngnix rewrite (cms and tomcat) - how to set it up correctly?
Good afternoon!!
Please help me with nginx and rewrites.
Initial Situation:
We had a Tomcat application that included both the frontend and part of the site for registered users. The URLs were (for example) www.server.com/news (for the front end) and www.server.com/customer/archive (for the back end).
Nginx has been configured to proxy everything to Tomcat:
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Client-IP $remote_addr;
}
location /app/ {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Client-IP $remote_addr;
}
Answer the question
In order to leave comments, you need to log in
If I understood everything correctly, then it is enough that the tomcat makes the links in itself relative, and not complete. In this case, when proxying, /app/ will be added automatically. There are of course other ways to solve the problem, but they are more like crutches)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question