https://example.com/admin redirects to https://adm

2019-07-19 06:31发布

问题:

The entire application works with Django + Nginx + Gunicorn using SSL(in production). But when I try to access django-admin page by https://example.com/admin and try to login it redirects me to (https://admin).

PS: Sorry for a silly question. Any inputs ?

回答1:

This sounds very similar to Django's HttpResponseRedirect seems to strip off my subdomain.

And if so, the likely issue is that either your nginx proxy or Gunicorn is not delivering the domain name (HTTP_HOST) to Django. Verify by examining request.META within Django.