Take the 2-minute tour ×

new on this side of StackExchange. I've been trying to set up an nginx server to serve as a front http server that redirects to other servers within the network (later on to be used for load ballancing, but for now we just want the proxying to work),

I have the following set up for the location:

   location /site/ {
        proxy_pass   http://www.mysite.com:port/site/;
        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;

My problem right now, is that, it loads everything well, on the first page (front page) and the second page (login form), but when the user logs in and is taken to the thirdpage (dashboard), the browser is unable to load certain pages that are dynamically loaded inside (think jsp includes).

The funny thing is, if I set up a location that goes to http://www.mysite.com:port and then just access it by http://localhost:8080/site/ it loads everything, does the login and a user is able to use everything inside, without a problem.

Now, you could say, "well, just make them use it that way", but I want to hide the full name of the page on the other server.

How can I do this without having these files returning error 500s?

PS: the proxy is set up to handle the data for a JBoss Aplication Server. (adding this here, because it might be the JBoss server not really enjoying the proxy handling of the name)

share|improve this question
add comment

1 Answer

I'd be thinking that it's not passing post/get/session data correctly? When playing with nginx proxying I find the best clues in tracking the timestamps between the proxybox nginx's logs at /var/log/nginx and comparing it to the logs on the system beings passed through. Often I find things like broken url rewrites(like accidentally configuring nginx to pass uri data to a _GET variable instead of passing the url raw), or things just "not found". Especially for 500 errors

share|improve this answer
add comment

Your Answer


