I have a location like:
location / {
set $api_name "Web";
proxy_intercept_errors on;
set $upstream upstream_a;
if ( $kms_in_cookie != "not_set" ) {
set $upstream $kms_in_cookie;
}
if ( $upstream_in_cookie != "not_set" ) {
set $upstream $upstream_in_cookie;
}
if ($cookie_zak != "") {
set $upstream upstream_b;
}
proxy_pass http://$upstream;
health_check uri=/healthcheck interval=30 fails=3 passes=3;}
Once I restart my NGINX, it failed:
nginx: [emerg] health check requires an upstream in
Any one has a idea about this? What does this error mean?
I had the same issue. From experimenting with it the issue appears to be the variable name in the proxy_pass
directive. If you use the name of a valid upstream the issue is resolved.
Clearly you are trying to direct traffic based on some request meta-data, and the above advice wont help with this. Your scenario is not an uncommon one so I would expect this to work. Looks like a bug in nginx, or at the very least a gap in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With