Django, Nginx & SSL


#1

If it’s not set correctly, all reversed_url and any pagination url from django-restframework would still use http instead of automatically obeying current request uri.

in settings.py for django 1.8+

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

in nginx server

proxy_redirect                      off;
proxy_set_header X-Forwarded-Proto  $scheme;

If you are using any older django, it’s better to upgrade anyway.