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

Middleware to redirect http traffic to https #2966

Closed
wants to merge 5 commits into from

Conversation

tovbinm
Copy link
Contributor

@tovbinm tovbinm commented Nov 6, 2019

Inspects X-Forwarded-Proto header and if it is set to http, redirects to Host with same URL with https schema; otherwise does nothing. This middleware is useful when a service is deployed behind a load balancer which does not support such redirect feature, e.g. Heroku.

Kleisli { req =>
(req.headers.get(`X-Forwarded-Proto`), req.headers.get(Host)) match {

case (Some(proto), Some(host)) if Scheme.fromString(proto.value).contains(Scheme.http) =>

This comment has been hidden.

This comment has been hidden.

Copy link
Member

@rossabaker rossabaker left a comment

👍 I'm going to backport it for 0.20 users.

@tovbinm
Copy link
Contributor Author

@tovbinm tovbinm commented Nov 26, 2019

Thanks. It seems that I need to fix the code style before it can be merged.

@tovbinm
Copy link
Contributor Author

@tovbinm tovbinm commented Nov 26, 2019

Done.

@rossabaker
Copy link
Member

@rossabaker rossabaker commented Nov 26, 2019

Backported into #2992, to be released in 0.20.15.

@rossabaker rossabaker closed this Nov 26, 2019
@tovbinm tovbinm mentioned this pull request Nov 26, 2019
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

4 participants