简体   繁体   中英

How to pass headers to auth-url in nginx ingress

What is the correct way to pass auth header in auth-url for external auth? Below is my current nginx ingress config:

nginx.ingress.kubernetes.io/auth-cache-key: $remote_user$http_authorization
nginx.ingress.kubernetes.io/auth-response-headers: Authorization
nginx.ingress.kubernetes.io/auth-signin: mydomain/signin
nginx.ingress.kubernetes.io/auth-url: mydomain/check

Traffic will first go to /signin, and after my external oauth signin, it will go to my another /redirect endpoint where I send Authorization header, and redirect back to the original url. But next time when traffic goes to original url and hits /check, it does not pass Authorization header to my /check endpoint so it fails the auth verification again. I thought nginx.ingress.kubernetes.io/auth-response-headers would pass the header for me but it did not work. Do you know how to pass header in my case?

Many thanks!

Have you tried setting specifically the header inside the auth-snippet annotation?

nginx.ingress.kubernetes.io/auth-snippet: |
    proxy_set_header Authorization $http_authorization;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM