Nginx Different Proxy Depend On Method
location ~* "(ngx.HTTP_POST|ngx.HTTP_DELETE|ngx.HTTP_PUT)" {
proxy_pass http://127.0.0.1:8080;
server {
location / {
# This proxy_pass is used for requests that don't
# match the limit_except
proxy_pass http://127.0.0.1:8080;
limit_except PUT POST DELETE {
# For requests that *aren't* a PUT, POST, or DELETE,
# pass to :9080
proxy_pass http://127.0.0.1:9080;
}
}
}
If is Evil… when used in location context
location / {
error_page 418 = @other;
recursive_error_pages on;
if ($something) {
return 418;
}
# some configuration
...
}
location @other {
# some other configuration
...
}