atom feed5 messages in ru.sysoev.nginxRe: nginx post ONE request to one mor...
FromSent OnAttachments
MaLiJun 14, 2011 11:37 pm 
Maxim DouninJun 15, 2011 12:49 am 
MaLiJun 15, 2011 1:02 am 
Maxim DouninJun 15, 2011 1:06 am 
MaLiJun 15, 2011 1:18 am 
Subject:Re: nginx post ONE request to one more upstream_addr
From:Maxim Dounin (mdou@mdounin.ru)
Date:Jun 15, 2011 1:06:25 am
List:ru.sysoev.nginx

Hello!

On Wed, Jun 15, 2011 at 04:03:30PM +0800, MaLi wrote:

Thanks Dounin,

actually, both 10.10.1.12 and 10.10.1.13 received the POST items with 1.php (so repeat ran the script) ,

Most likely it's failed to respond in time, and that's why nginx retried request. Don't hesitate to look into error_log, it should has details.

and why both servers being recorded as Upstream_addr in the log file?

Variable $upstream_addr should contain addresses of all upstream servers tried, this is how it works.

2011/6/15 Maxim Dounin <mdou@mdounin.ru>

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