Closed vladimir-mencl-eresearch closed 8 years ago
Hi, FYI, I just found that once I set the Apache header (the change to Apache SSL VirtualHost configuration), Django starts interpreting the request as having arrived over SSL even without setting settings.SECURE_PROXY_SSL_HEADER
. But, this behavior of uwsgi is undocumented, so I'd still rather explicitly tell Django which header to look for (the change in settings.py).
Cheers, Vlad
Good catch. I agree we should enable SESSION_COOKIE_SECURE
by default. As for SECURE_PROXY_SSL_HEADER
, however, I see two issues:
settings.py
but leave it commented out by default. As for the apache config, I believe that for this directive to make sense, it would be better to include it as part of a section that shows how to proxy the app to uwsgi (or say gunicorn), rather than let mod_wsgi handle it.X-Forwarded-Protocol: https
.What do you think? If you agree, would you mind updating the patch accordingly?
Hi,
Our deployment uses just mod_proxy to pass the requests to uwsgi via HTTP. And we pass the requests from both 443 and 80. And in our case, uwsgi picks up the X-Forwarded-SSL: on
header and marks the request as secure, without having to actually configure the header in Django (the Django setting was ment more as a back up). And uwsgi ignores the X-Forwarded-Protocol: https
.
But I can work with that - I can set the header in our customized local_settings.py.
So the way forward I see is that I would:
X-Forwarded-Protocol: https
Does that sound alright to you?
Cheers, Vlad
PS: In our own deployment, I'd then also clear the same header in the plain-http VirtualHost - thanks for the Django link!
Hi Zenon, would you be happy with this revision?
Cheers, Vlad
Thanks! I am rebasing this on rewritten master (just to spare you the trouble) and merging it.
RequestHeader set
directive into sample Apache configuration in the documentationsettings.py
(and notlocal_settings.py
) as these should not need any deployment time customization.