Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

[nginx-ingress-controller] Basic auth header is not stripped #1383

Closed
atombender opened this issue Jul 18, 2016 · 6 comments
Closed

[nginx-ingress-controller] Basic auth header is not stripped #1383

atombender opened this issue Jul 18, 2016 · 6 comments

Comments

@atombender
Copy link
Contributor

If you use basic auth in an ingress, then the Authorization header is passed along to the proxied upstream, which can result in incorrect behaviour if the upstream doesn't expect one.

For example, Drone will ignore its session cookie if the auth header is specified.

The correct behaviour is to strip the header and not pass it to the upstream.

Until this is fixed, I've been trying to find a workaround by injecting a custom Nginx directive, but I can't a way. Is there one?

@aledbf
Copy link
Contributor

aledbf commented Jul 18, 2016

@atombender use a custom template and add proxy_set_header Authorization ""; in the location with the basic auth

@atombender
Copy link
Contributor Author

atombender commented Jul 18, 2016

@aledbf Thanks, I discovered the template just now. That's just a temporary workaround, of course.

@aledbf
Copy link
Contributor

aledbf commented Jul 18, 2016

That's just a temporary workaround, of course.

Yes, tomorrow I will open a PR to remove the Authorization header when the auth annotation is used

@atombender
Copy link
Contributor Author

@aledbf: This PR fixed the issue for me.

@aledbf
Copy link
Contributor

aledbf commented Jul 18, 2016

@atombender awesome. Thanks!

@Yannic92
Copy link

Sorry that I have to ask under a closed issue, but how is it possible to pass the authorization header to an upstream now? I see the condition {{ if $location.BasicDigestAuth.Secured }} but I don't know how to set it to false.
I want my service to evaluate the Authorization header, not nginx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants