# Load Balancing with rewrite

**URL:** <https://www.ruby-forum.com/t/load-balancing-with-rewrite/200515>\
**Category:** NGINX\
**Created:** [December 14, 2010, 8:08am UTC](https://www.ruby-forum.com/t/load-balancing-with-rewrite/200515 "2010-12-14T08:08:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 14, 2010, 8:08am UTC](https://www.ruby-forum.com/t/load-balancing-with-rewrite/200515/1 "2010-12-14T08:08:42Z")

</div>

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](http://localhost:8090/test)  
in our web services received url:  
[b][i][u][http://mysite/test[/u][/i][/b]](http://mysite/test%5B/u%5D%5B/i%5D%5B/b%5D) , 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]](http://testbox1:50011/test%5B/u%5D%5B/i%5D%5B/b%5D)  
or at the [http://testbox2:50012](http://testbox2:50012)

```
  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:

> **[Load Balancing with rewrite](https://forum.nginx.org/read.php?2,158447,158447#msg-158447)**
>
> 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 {
