django-allauth: how to modify email confirmation url?
Django get hostname and port from HTTP headers. Add proxy_set_header Host $http_host;
into your nginx configuration before options proxy_pass
.
I had the same problem, and also found that ferrangb's solution had no effect on outgoing allauth emails. mr_tron's answer got me halfway, but I had to do a little bit more:
1) In nginx configuration, put
proxy_set_header Host $http_host
before options proxy_pass.
2) In settings.py
, add the domain name to ALLOWED_HOSTS
. I also added the www version of my domain name, since I get traffic to both addresses.
ALLOWED_HOSTS = ['127.0.0.1', 'example.com', 'www.example.com']
And, of course, restart nginx and gunicorn or whatever is serving your Django. With the first step but not the second, all hits to the site were instant 400 errors (unless DEBUG = True
in settings.py
.)