nginx reverse proxy hide redirects

Posted by NZCoderGuy on Server Fault See other posts from Server Fault or by NZCoderGuy
Published on 2014-06-03T02:00:54Z Indexed on 2014/06/03 3:29 UTC
Read the original article Hit count: 419

Filed under:
|
|

I've Nginx as a reverse proxy for two sites A and B running behind.

The users go from public -> reverse proxy -> site A -> site B (from A to B clicking links)

What would be a typical configuration for a scenario like this? The url in the browser should be always the reverse proxy

This is what I've so far but is not working

worker_processes  2;
error_log logs/error.log info;

events {
    worker_connections 1024;
}

http {
    server {
        resolver 127.0.0.1;
            listen 8080;

        location / {            
                set $target 'siteA';                  

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;

            rewrite ^(.*) $1 break;
                proxy_pass http://$target;
        }
    }
}

© Server Fault or respective owner

Related posts about nginx

Related posts about rewrite