Skip to content

Instantly share code, notes, and snippets.

@ruyaoyao
Forked from wojons/gist:6154645
Created February 26, 2016 10:01
Show Gist options
  • Select an option

  • Save ruyaoyao/041be714455c915a6d0f to your computer and use it in GitHub Desktop.

Select an option

Save ruyaoyao/041be714455c915a6d0f to your computer and use it in GitHub Desktop.
nginx dont retry next upstream on post or put when timeout error
upstream mash {
ip_hash;
server 127.0.0.1:8081;
server 192.168.0.11:8081;
}
server {
location / {
if ($request_method = POST ) {
proxy_next_upstream error;
}
if ($request_method = PUT ) {
proxy_next_upstream error;
}
proxy_pass http://mash/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment