39π
I have the same problem with my development server.
After some internet search Iβve found this discussion (nginx, apache, and odd admin error) where the solution is to modify the proxy configuration of nginx.
The configuration setting to modify is:
proxy_set_header Host $host;
the solution is to add the port number:
proxy_set_header Host $host:$server_port;
In my ngnix + apache2 (with worker mpm) + django now all works well.
10π
You want to pass on the original HTTP Host header, which arrived at nginx:
proxy_set_header Host $http_host;
This appears to be a bug with the default configuration of nginx in Debian/Ubuntu, which uses only $host
: $host
will not contain the $server_port
.
(This is configured in /etc/nginx/proxy_params
for the Debian/Ubuntu package, and you might override it in your configuration after including it.)
Please note that $host:$server_port
is different from $http_host
.
See http://wiki.nginx.org/HttpCoreModule#.24host for an explanation.
Reported and fixed in Debian: http://bugs.debian.org/733016
- [Django]-Sending post data from angularjs to django as JSON and not as raw content
- [Django]-How do I install psycopg2 for Python 3.x?
- [Django]-Django models.py Circular Foreign Key
6π
Given everything youβre concerned with is clear HTTP (unlike something like AJP for instance) Iβd run a protocol analyser such as Wireshark on the host and determine at which point the redirect is introduced.
- [Django]-Altering one query parameter in a url (Django)
- [Django]-In django, how do I sort a model on a field and then get the last item?
- [Django]-Using django-admin on windows powershell
2π
Check the error logs. On Linux mine are at /var/log/apache2. Just running a search for error.log should turn it up.
- [Django]-Django Multiple Authentication Backend for one project
- [Django]-Django apps aren't loaded yet when using asgi
- [Django]-Name '_' is not defined
0π
If you find that this occurs with a url derived from the get_absolute_url() method of a model, you should use pass that path to HttpRequest.build_absolute_url() in order to prepend the hostname and port to the path.
- [Django]-Python 3 list(dictionary.keys()) raises error. What am I doing wrong?
- [Django]-Name '_' is not defined
- [Django]-Django 1.7 β App 'your_app_name' does not have migrations