Welcome! Log In Create A New Profile

Advanced

nginx-1.4 proxy requests being continious

Daniel Black
May 08, 2013 08:40PM
A request for /img/file_doesnt_exist.jpg results in the backend server (192.168.129.90) getting continuous requests for the same file (which doesn't exist there either so 404 each time), while the original requester waits and nginx keeps asking the backend the same.

I'm using the nginx-1.4.1 from the debian squeeze repository.

Is there a better way do to this config? The aim for for all web servers to have the same config so a resource that aren't synced yet still get served a response if it exists somewhere but without the requests ending up in a circular loop.

My current, hopefully not too cut down, config is:

upstream imgweb_other {
server 192.168.129.90;
server 173.230.136.6 backup;
}

server {

proxy_read_timeout 15;
proxy_connect_timeout 3;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;

location ~ ^/img/(.*)
{
expires 2592000;
add_header Cache-Control public;
alias /var/www/live_site_resources/$1;
error_page 404 = @imgweb_other;
}

location @imgweb_other {
# we only want to fallback once so use user_agent as a flag
if ( $http_user_agent = IMGWEB ) {
return 404;
}
proxy_pass http://imgweb_other;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header User-Agent IMGWEB;
}

}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx-1.4 proxy requests being continious

Daniel Black May 08, 2013 08:40PM

Re: nginx-1.4 proxy requests being continious

Daniel Black May 11, 2013 02:14AM

Re: nginx-1.4 proxy requests being continious

Maxim Dounin May 11, 2013 07:44PM

Re: nginx-1.4 proxy requests being continious

Daniel Black May 11, 2013 10:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 72
Record Number of Users: 8 on December 15, 2016
Record Number of Guests: 386 on August 02, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready