Django + gunicorn + nginx Invalid HTTP_HOST header

Question:

Django + gunicorn + nginx server configured. Debug = false From time to time there are different messages from Jangi, but the following is not clear how it happened. The following message came:

"Invalid HTTP_HOST header: u '/ project_path / run / gunicorn.sock:'. The domain name provided is not valid according to RFC 1034/1035"

Below is the rest of the code sent to me by mail:

Request repr():
<WSGIRequest
path:/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'HTTP_CONNECTION': 'close',
    'HTTP_X_FORWARDED_FOR': '94.102.49.210',
    'PATH_INFO': u'/',
    'QUERY_STRING': '',
    'RAW_URI': '/',
    'REMOTE_ADDR': '',
    'REQUEST_METHOD': 'GET',
    'SCRIPT_NAME': u'',
    'SERVER_NAME': '/путь_к_проэкту/run/gunicorn.sock',
    'SERVER_PORT': '',
    'SERVER_PROTOCOL': 'HTTP/1.0',
    'SERVER_SOFTWARE': 'gunicorn/19.1.1',
    'gunicorn.socket': <socket._socketobject object at 0x7f4ce037f2f0>,
    'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWraper object at 0x7f4ce0f59ad0>,
    'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>,
    'wsgi.input': <gunicorn.http.body.Body object at 0x7f4ce17f0550>,
    'wsgi.multiprocess': True,
    'wsgi.multithread': False,
    'wsgi.run_once': False,
    'wsgi.url_scheme': 'http',
    'wsgi.version': (1, 0)}>

Answer:

from comment:


Invalid title.

If a single message is not worth worrying about, just a rare exception, if it is frequent, you need to look at which request it occurs.

I recommend installing sentry, there is more information about errors, and more convenient: you can see how often the error is repeated.

Scroll to Top