Welcome! Log In Create A New Profile


Django proxy_pass redirect issues

September 07, 2018 06:54AM
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:

It seems I forgot some proxy header but I tried some combinations and I dont find the good one.

Thanks in advance,
Subject Author Posted

Django proxy_pass redirect issues

littlevk September 07, 2018 06:54AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready