SSL for Django Website Behind Dreamhost Reverse Proxy

Another artifact of the Django site migration to Dreamhost VPS is that Django thought absolute URLs should be http, not https. Which meant all my pages `link[rel=canonical]` tags were for http. Here’s how I fixed it.

I discovered today that all of my site’s pages had link[rel=canonical] tags with http instead of https. This is another artifact of the whole Dreamhost-dropped-support-forced-move-to-VPS saga.

I found the fix on ubuntu.com: Django behind a proxy: Fixing absolute URLs. The problem is well described there, as is the fix:

# Setup support for proxy headers
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

I added that to my settings.py filed and restarted my linger service with systemctl --user restart orangegnome.service, and that did the trick.