X
X

Select Your Currency

Türk Lirası $ US Dollar
X
X

Select Your Currency

Türk Lirası $ US Dollar
Kurban Bayramı’na Özel %40 İndirim Detaylı Bilgi İçin Tıklayın!

Knowledge Base

HomepageKnowledge BaseGeneralSolution to Django Invalid HTTP HOS...

Solution to Django Invalid HTTP HOST header Error

If you are getting an error when publishing your Django project using a domain name, the reason is that the proxy HOST information in the HTTP service is incorrect. In other words, if there is a service such as unicorn, NGINx or Apache sends the HOST information incorrectly when redirecting to the unicorn via proxy.

proxy_set_header Host '$http_host';
If additional characters are added to the '$http_host' section, this URL like \\ is sent to uvicorn and the URL rules cannot be matched.

NGINX sample code:

location / {
proxy_set_header Host '$http_host';
proxy_set_header X-Forwarded-For '$proxy_add_x_forwarded_for';
proxy_set_header X-Forwarded-Proto '$http_x_forwarded_proto';
proxy_redirect off;
proxy_pass http://notifytube_django3;
proxy_connect_timeout 500;
proxy_read_timeout 600;
}


NOTE: Finally, do not forget to restart the NGINX service.

Can't find the information you're looking for?

You have examined the knowledge base in detail, but if you cannot find the information you need,

Create a Support Ticket
Did you find it useful?
(72 times viewed. / 0 people found helpful.)