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

Caravel redirects HTTPS-terminated load balancer traffic to HTTP #1139

Closed
bobziuchkovski opened this issue Sep 19, 2016 · 2 comments · Fixed by #1150
Closed

Caravel redirects HTTPS-terminated load balancer traffic to HTTP #1139

bobziuchkovski opened this issue Sep 19, 2016 · 2 comments · Fixed by #1150

Comments

@bobziuchkovski
Copy link
Contributor

bobziuchkovski commented Sep 19, 2016

We're trying to run caravel 0.10.0 behind a load balancer on Amazon and terminate HTTPS/SSL traffic on the load balancer. We've noticed that we can access https://<caravel-behind-lb>/login, but when we supply user credentials, caravel redirects back to the plaintext http://<caravel-behind-lb>/login location. This is a bummer, and has been flagged as part of a third-party security audit.

Is there a configuration option we're missing to tell caravel to use https urls, or to tell it to respect X-Forwarded-Proto headers?

@mistercrunch
Copy link
Member

Seems like there's a solution here:
http://stackoverflow.com/questions/23347387/x-forwarded-proto-and-flask

I'd approve a PR that would add ENABLE_PROXY_FIX = False to caravel/config.py and:

if config.get('ENABLE_PROXY_FIX'):
    app.wsgi_app = ProxyFix(app.wsgi_app)

to caravel/__init__.py

bobziuchkovski added a commit to usertesting/caravel that referenced this issue Sep 20, 2016
Add an ENABLE_PROXY_FIX config param.  When set to True, insert the Werkzeug ProxyFix
middleware.  This middleware extracts and applies the X-Forwarded-* headers that are
inserted by common proxies and load balancers.  Fixes apache#1139.
bobziuchkovski added a commit to usertesting/caravel that referenced this issue Sep 20, 2016
Add an ENABLE_PROXY_FIX config param.  When set to True, insert the Werkzeug ProxyFix
middleware.  This middleware extracts and applies the X-Forwarded-* headers that are
inserted by common proxies and load balancers.  Fixes apache#1139.
@bobziuchkovski
Copy link
Contributor Author

bobziuchkovski commented Sep 20, 2016

@mistercrunch Thanks for pointing that out. I've submitted a PR (#1150) that adds the ProxyFix support. We just deployed 0.10.0 with that commit cherry-picked and confirmed we're no longer being redirected from https to http.

mistercrunch pushed a commit that referenced this issue Sep 20, 2016
Add an ENABLE_PROXY_FIX config param.  When set to True, insert the Werkzeug ProxyFix
middleware.  This middleware extracts and applies the X-Forwarded-* headers that are
inserted by common proxies and load balancers.  Fixes #1139.
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 a pull request may close this issue.

2 participants