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

perfer X-Forwarded-Proto to prevent users lying #1367

Merged
merged 1 commit into from
Aug 14, 2017

Conversation

haarg
Copy link
Contributor

@haarg haarg commented Aug 1, 2017

X-Forwarded-Proto should be the preferred header to used to check if the
front end connection was HTTPS. Proto is the de facto standard for
this, and is recommended in the deployment documentation.

If the -Protocol header is checked first, that means most setups that
only add a -Proto header will pass through a user provided -Protocol
header, allowing users to lie about the protocol used.

Ideally this would only check one header, and the reverse proxy would be
required to send that header. Leaving this with the fallback behavior
for now for backwards compatibility.

X-Forwarded-Proto should be the preferred header to used to check if the
front end connection was HTTPS.  Proto is the de facto standard for
this, and is recommended in the deployment documentation.

If the -Protocol header is checked first, that means most setups that
only add a -Proto header will pass through a user provided -Protocol
header, allowing users to lie about the protocol used.

Ideally this would only check one header, and the reverse proxy would be
required to send that header.  Leaving this with the fallback behavior
for now for backwards compatibility.
@bigpresh
Copy link
Member

This looks reasonable to me!

See also #590 for a very old, much more in-depth consideration of behind-proxy stuff - but I think this has value in being merged now as a quick improvement.

Mozilla agree - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto describes -Proto as "a de-facto standard header", and mentions -Protocol under "Other non-standard forms", so that's enough as far as I'm concerned to accept that, yes, we should look for -Proto first, as it's the most likely one.

@bigpresh bigpresh merged commit b9f3709 into PerlDancer:master Aug 14, 2017
@xsawyerx
Copy link
Member

👍

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.

3 participants