nginx post ONE request to one more upstream_addr

Maxim Dounin mdounin at mdounin.ru
Wed Jun 15 11:50:01 MSD 2011


Hello!

On Wed, Jun 15, 2011 at 02:38:08PM +0800, MaLi wrote:

> hi, everyone,
> 
>  nginx version is 0.8.53,
> configure (http definition)  is :
> ====================================
> http{
>     upstream my_loads {
>         server 10.10.1.12;
>         server 10.10.1.13;
>     }
> 
>     log_format combined_addsvr '$remote_addr - $remote_user [$time_local]  '
>                         '"$request" $status $body_bytes_sent '
>                         '"$http_referer" "$http_user_agent" $upstream_addr
> $upstream_cache_status ';
>     access_log logs/access.log combined_addsvr;
> 
>     server {
>         listen 80;
>         server_name mytest.com;
>         client_max_body_size 100m;
>         proxy_buffering off;
>         proxy_read_timeout 120;
>         proxy_send_timeout 120;
>         client_body_timeout 120;
>         send_timeout  120;
> 
>         location / {
>             proxy_pass http://my_loads/;
>             proxy_set_header Host $host;
>             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>         }
>     }
> ===========================================
> 
> there is a strange line in log file: (sorry to use xxx replace of true url)
> 192.168.1.1 - - [14/Jun/2011:20:53:24 +0800]  "POST /1.php HTTP/1.1" 200
> 3729558 "http://mytest.com/xxx" "Mozilla/4.0 (compatible; MSIE 7.0;)"
> 10.10.1.12:80, 10.10.1.13:80 -
> 
> when nginx deals with 1.php, it sends  POST to  all upstream servers!
> 
> the next is normal log:
> 192.168.1.1 - - [14/Jun/2011:20:53:44 +0800]  "POST /1.php HTTP/1.1" 302 2 "
> http://mytest.com/xxx" "Mozilla/4.0 (compatible; MSIE 7.0;)" 10.10.1.12:80 -
> 
> Could anyone tell me if it is  a bug or just any configure improperly?
> thanks.

nginx will retry request on next upstream server if first one 
failed, see here:

http://wiki.nginx.org/HttpProxyModule#proxy_next_upstream

Maxim Dounin



More information about the nginx mailing list