Problem with Kubernetes nginx ingress custom errors and auth-signin combination

7/23/2020

I was looking to find out about custom error pages. I have set the --default-backend-service=$(POD_NAMESPACE)/custom-errors to point to the service and then also the custom-http-errors config map property.

Pretty straight forward and all working as expected.

My problem appears to be on ingress' with the annotation nginx.ingress.kubernetes.io/auth-signin

WITH the annotation: 1. If you are logged in, then you get the standard default error page for all errors (the one that I don’t want) 2. If you are not logged in, you are correctly redirected to auth.

WITHOUT the annotation: 1. If you are logged in, then you get the correct custom error pages 2. If you are not logged in, you now get a standard default 401 error page instead of the sign-in URL

I can only seem to get one or the other, depending on the above.. Ideally what I’m looking for is a combination of the above, i.e.

  1. If you are logged in, then you get the correct custom error pages (correct WITHOUT annotation)
  2. If you are not logged in, you are correctly redirected to auth. (correct WITH annotation)

Any help on this would be appreciated.

-- Grant
kubernetes
kubernetes-ingress
nginx
nginx-ingress

0 Answers