I would like to use nginx as a proxy to a Tomcat non-root app but am having problems to do that. This is the code that I use:
location / {
proxy_pass http://127.0.0.1:8080/app_v1.1.0/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
Now, this works ok for the app login screen but doesn't work for anything beyond that. After I login, the login page comes back so I think something is wrong with this kind of proxying, some kind of rewrite is obviously missing.
If I change it to something like:
location / {
proxy_pass http://127.0.0.1:8080/;
}
or:
location /app_v1.1.0 {
proxy_pass http://127.0.0.1:8080/app_v1.1.0
}
Then it works but i have to access my app via 'http:///app_v1.1.0' ... Can this be circumvented somehow?
Thank you.
0 Answers