Invalid HTTP_HOST header: "localhost: 90, localhost: 90". The provided domain name is not valid according to RFC 1034/1035

I am trying to configure nginx along with Gunicorn for a Django project. nginx gives me the following error:

DisallowedHost at /
Invalid HTTP_HOST header: 'localhost:90,localhost:90'. The domain name provided is not valid according to RFC 1034/1035.

This is my nginx configuration

    server {

        listen 90;
        listen [::]:90;

        server_name xxxx;

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/user/djangopro/djangoapp;
        }

        location / {
            include proxy_params;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_buffering off;
            proxy_redirect off;

            proxy_pass http://localhost:8200/;
        }
    }

Gunicorn maintains the site correctly localhost:8200. Can someone tell me what causes the error?

+4
source share
1 answer

. , Flask Djano? proxy_set_header Host $http_host; , ( ). , , , IP-, ip- , django IP-, . Djano: https://code.djangoproject.com/ticket/28028

, ( ), , - 2 , :)

edit: , - include proxy_params;, proxy_set_header Host $http_host;. proxy_params proxy_set_header Host $http_host;, , , . proxy_params /etc/nginx/proxy_params, Ubuntu ( ).

0

Source: https://habr.com/ru/post/1676256/


All Articles