0

I want to check that the ability to connect to the desired upstream is broken. Only the ability to connect, i.e. I want to ignore the 5xx errors from upstream.

To do this, I'm trying to do the following:

location /ping/<ip> {
  proxy_pass http://ip/;
  proxy_intercept_errors off;
  error_page 502 =200 @error_page_with_message;
}

Thanks to proxy_intercept_errors off, error_page only intercepts errors from nginx (i.e. only connection-related errors)

But now it turns out that /ping/<ip> returns any statuses, and if the nginx error — 200 with the error text. Can I make the nginx error return 502, and in other cases 200?

deevroman
  • 99
  • 1
  • 2
  • 14

0 Answers0