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

Added support for AWS Cloudfront forwarded scheme header #2297

Merged

Conversation

BasileTrujillo
Copy link
Contributor

Added support for AWS Cloudfront forwarded scheme header

Description

  • What went wrong?
    I host some Grav websites in AWS EC2 instances behind AWS Cloudfront (to provide free SSL and caching). I do not have any ssl certificates installed in the EC2 instances (since Cloudfront handle it for us, such as a loadbalancer), so I actually have Cloudfront that handle HTTPS but communicates internally with the EC2 instance over HTTP. But, I recently figured out that Cloudfront does not provide the standard HTTP_X_FORWARDED_PROTO header but provide a HTTP_CLOUDFRONT_FORWARDED_PROTO header instead.

  • Resolution
    Adding the support of this header prior to REQUEST_SCHEME because Cloudfront provide it but with the value of the internal communication scheme (in my case http).
    Auto build the port from the scheme when we are in this situation because Cloudfront does not provide any kind of HTTP_X_FORWARDED_PORT header...

  • Extra notes
    I don't know if there is any unit tests for this function, so let me know if there is some to implement or edit.

AWS Cloudfront does not provide HTTP_X_FORWARDED_PROTO header but provide a HTTP_CLOUDFRONT_FORWARDED_PROTO header instead
@rhukster rhukster merged commit e8825be into getgrav:develop Jan 9, 2019
@BasileTrujillo BasileTrujillo deleted the feature/cloudfront_forwarded_proto branch April 14, 2019 20:30
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.

2 participants