Load Balancing with rewrite

zerlite nginx-forum at nginx.us
Tue Dec 14 10:06:53 MSK 2010


Hi!,
       I'm doing a project to load balance our web services, but our web
services are very strict in terms of received url.

nginx config

  upstream mysite {
		server testbox1:50011;
		server testbox2:50012
	}
	
    server {
        listen       8090;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
			proxy_pass         http://mysite;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    Example of request url for the Web services
                              http://testbox1:50011/test  this is a test
url for the web services just a simple test.
    But when I tried using the nginx with loadbalancing
        for nginx http://localhost:8090/test
        in our web services received url:
[b][i][u]http://mysite/test[/u][/i][/b] , our web services needs the
actual server name and port to be successful with the testcase our web
services should received [b][i][u]http://testbox1:50011/test[/u][/i][/b]
or at the [b][i][u]http://testbox2:50012[/u][/i][/b]
    
      Can anyone help me in rewriting the actual server name being used
for the request in the round robin/load balancing mode. 
      Thank you very much.

Sincerely,
Gerald

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,158447,158447#msg-158447




More information about the nginx mailing list