ingress header from auth-service

4/16/2020

we define a header 'X-Auth-Info' for auth response, the target is if we get this header from auth service, in the configuration-snippet check and redirect to other site, we want to avoid this behavior added in the upstream service.

unfortunately looks this is not supported, see the below nginx ingress error, i can get this header in the upstream backend service, can't make sure whether it can get in the nginx configuration? or is there any possible solution?

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/auth-response-headers: X-Auth-Info
    nginx.ingress.kubernetes.io/auth-snippet: proxy_set_header X-Original-URI $request_uri;
    nginx.ingress.kubernetes.io/auth-url: 'http://auth.dev.versalinks.net/auth'
    nginx.ingress.kubernetes.io/configuration-snippet: 'if ( $x_auth_info = "xyz1" ) {  return 301 https://www.example.com;}'
    nginx.ingress.kubernetes.io/service-weight: ''
    nginx.ingress.kubernetes.io/use-regex: 'true'
2020/04/16 15:37:18 [notice] 8272#8272: ModSecurity-nginx v1.0.0
2020/04/16 15:37:18 [emerg] 8272#8272: unknown "x_auth_info" variable
nginx: [emerg] unknown "x_auth_info" variable
-- user1023333
kubernetes
nginx-ingress

0 Answers