uWSGI and Django Secure Requests
A colleague and I ran into a frustrating situation this evening when transitioning a site from Apache and modwsgi to uWSGI. Django's request.is_secure()
wasn't working correctly. After much Googling and shouting at the SSH console, we finally discovered the UWSGISCHEME uWSGI parameter.
To fix the issue, we edited /etc/nginx/uwsgiparams (which originally comes from nginx/uwsgiparams in the uWSGI tarball) and added an additional param at the bottom:
uwsgi_param UWSGI_SCHEME $scheme;
This prompts uWSGI to set wsgi.url_scheme to the appropriate value, which Django then detects in the wsgi handler.
I'd really love to see this in the documentation on the uWSGI site, or (even better) included by default in the uwsgi_params in the tarball. In the meantime, though, it's a relatively quick and easy fix. Enjoy!