Django proxy_pass redirect issues
littlevk
nginx-forum at forum.nginx.org
Fri Sep 7 10:54:51 UTC 2018
Hello,
I faced an issue with nginx proxy_pass to a Django app.
I configured nginx server to this django:
#######
server {
listen 443 ssl;
server_name mydjango.com;
ssl on;
ssl_certificate /opt/ssl/nginx/mydjango.crt;
ssl_certificate_key /opt/ssl/nginx/mydjango.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 120M;
#charset koi8-r;
access_log /var/log/nginx/backend.mydjango.app.log main;
error_log /var/log/nginx/backend.mydjango.app.error.log error;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend.mydjango.app:3080/;
proxy_redirect off;
}
}
#######
But connecting to NginX reverse proxy (https://mydjango.com) django starts
redirecting and finish with a bad request changing in my browser to:
http://127.0.0.1:5002
It seems I forgot some proxy header but I tried some combinations and I dont
find the good one.
Thanks in advance,
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,281123,281123#msg-281123
More information about the nginx
mailing list