Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the proxy's url if available #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

use the proxy's url if available #2

wants to merge 1 commit into from

Conversation

thedumbterminal
Copy link

When a PSGI app is used behind a reverse proxy the the URL that the client uses can be different from the app's URL, which will normally break digest auth.

Here's a small fix that solves my setup, maybe this fix could be made more generic?

@miyagawa
Copy link
Owner

Yeah it is terrible if you need to do this in every piece of middleware. You have to handle this at the outer level using something like ReverseProxy middleware.

@thedumbterminal
Copy link
Author

I'm already using Plack::Middleware::ReverseProxy and Plack::Middleware::ReverseProxyPath for updating the other headers/environment in my app. Unfortunately if you alter the URI path in the AUTHORIZATION header then authentication will never succeed as the generated digest on the server will not match the one created by the client.

I wonder if creating a new module (Plack::Middleware::Auth::Digest::Reverse etc.) that will include this patch would be a better option as this is kind of an edge case situation.

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

Successfully merging this pull request may close these issues.

None yet

2 participants