Brandon Konkle
Brandon Konkle

Freelance full-stack Node & React developer, supporter of intersectional social justice, enthusiastic nerd, loving husband, and father. Hire me for your next project!

I'm a Node & React developer with more than 8 years of experience creating high performance web applications and architectures. If you're looking for help with your next project, hire me today!

My Newsletter


Subscribe to my newsletter for a weekly look at the latest news, tools, and techniques from the React community.

Tags


Share


Twitter


uWSGI and Django Secure Requests

Brandon KonkleBrandon Konkle

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!

I'm a Node & React developer with more than 8 years of experience creating high performance web applications and architectures. If you're looking for help with your next project, hire me today!

Comments