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

secure_proxy_ssl_header with gunicorn #1762

Closed
samuelcolvin opened this issue Mar 28, 2017 · 4 comments · Fixed by #1834
Closed

secure_proxy_ssl_header with gunicorn #1762

samuelcolvin opened this issue Mar 28, 2017 · 4 comments · Fixed by #1834
Assignees

Comments

@samuelcolvin
Copy link
Member

Long story short

I think it's not possible to set secure_proxy_ssl_header when deploying with gunicorn.

Expected behaviour

gunicorn config or environment variable should allow me to set secure_proxy_ssl_header='X-Forwarded-Proto' so request.scheme is correct.

Actual behaviour

No apparent way to set it.

Steps to reproduce

Can give more detail if required.

Your environment

Heroku, but should be the same with any other.

@samuelcolvin
Copy link
Member Author

samuelcolvin commented Mar 28, 2017

currently i'm using

secure = 'https' in (request.scheme, request.headers.get('X-Forwarded-Proto'))
ws_scheme = 'wss' if secure else 'ws'
ws_url = f'{ws_scheme}:https://{request.host}/ws'

In addition to fixing secure_proxy_ssl_header it would be great if there was request.secure: bool to avoid the need for == 'https' etc.

@fafhrd91
Copy link
Member

do you want to work on this?

@samuelcolvin
Copy link
Member Author

Can do, just a key word argument to Application should work.

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants