I have the following kubernetes nginx annotation. My goal is to return a 200 whenever nginx returns a 503, so I have written the snippet you see below. However, when nginx returns 503 I still see the custom nginx 503 page. Would someone know what I am doing wrong?
nginx.ingress.kubernetes.io/auth-snippet: |-
auth_request_set $auth_resp_jwt $jwt;
auth_request_set $auth_resp_err $err;
auth_request_set $auth_resp_failcount $failcount;
nginx.ingress.kubernetes.io/server-snippet: |-
location @error503 { return 200 }
You can try this
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
if ($status == 503) {
return 200;
}
This snippet checks the status code and returns a 200 if it's 503.