0

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.

2
  • Perhaps this will answer your question? stackoverflow.com/questions/18936753/…
    – Mr Nil
    Feb 4, 2014 at 19:08
  • I've tried it already, but that rewrite doesn't seem to help :-/ Maybe the application is broken in some way. I made a temporary fix by renaming app.war to ROOT.war and proxying '/' although I would like to do it the other way. Feb 5, 2014 at 22:19

0

You must log in to answer this question.

Browse other questions tagged .