Nginx return 444 depending on upstream response code
- by Mark
I have nginx setup to pass to an upstream using proxy pass. The upstream is written to return a 502 http response on certain requests, rather then returning the 502 with all the header I would like nginx to recoginse this and return 444 so nothing is returned. Is this possible?
I also tried to return 444 on any 50x error but it doesn't work either.
location / {
return 444;
}
location ^~ /service/v1/ {
proxy_pass http://127.0.0.1:3333;
proxy_next_upstream error timeout http_502;
error_page 500 502 503 504 /50x.html;
}
location = /50x.html {
return 444;
}
error_page 404 /404.html;
location = /404.html {
return 444;
}