nginx post ONE request to one more upstream_addr
Maxim Dounin
mdounin at mdounin.ru
Wed Jun 15 12:07:02 MSD 2011
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.
Maxim Dounin
>
>
>
> 2011/6/15 Maxim Dounin <mdounin at 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
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list