Skip to content

Redirect to a subdomain mapped to a private IP's SSL doesn't seem to work in a Django app #118

Answered by anjanesh
anjanesh asked this question in Q&A
Discussion options

You must be logged in to vote

Solved this after a long time via https://forum.djangoproject.com/t/request-scheme-is-not-honoring-https/25099/2.

On my server, the django server was running behind an NGINX acting as a proxy which was causing Django not to recognize that the server is on https.

All I had to do was this in my django's settings.py file :

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

This one-line of missing code caused a whole lot of debugging.

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@rayluo
Comment options

@anjanesh
Comment options

@rayluo
Comment options

@anjanesh
Comment options

Comment options

You must be logged in to vote
1 reply
@anjanesh
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by rayluo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants