Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save linuxkathirvel/3f88774d9a23ed73045223fc2ecab200 to your computer and use it in GitHub Desktop.
Save linuxkathirvel/3f88774d9a23ed73045223fc2ecab200 to your computer and use it in GitHub Desktop.
How to fix "DisallowedHost at / Invalid HTTP_HOST header:. The domain name provided is not valid according to RFC 1034/1035." error in Django?

How to fix "DisallowedHost at / Invalid HTTP_HOST header:. The domain name provided is not valid according to RFC 1034/1035." error in Django?

Solution

  • Don't add include proxy_params; in Django application's NGINX configuration file.
  • Cross-check the Django application's NGINX configuration. If include proxy_params; line added, remove it.
  • proxy_params(/etc/nginx/proxy_params) file have proxy_set_header Host $http_host; line already. It will override proxy_set_header Host $host;

Related notes

  1. Security configurations in Django while deploying on production
  2. How to fix ERR_TOO_MANY_REDIRECTS issue in Django+Gunicorn+NGINX?

References

  1. django- nginx: open() “/etc/nginx/proxy_params” failed (2: No such file or directory) in /etc/nginx/sites-enabled/myproject:11
  2. Django + Gunicorn + Nginx: Bad Request 400 in Debug=True
  3. "Bad request 400" in Django. Beyond the ALLOWED_HOSTS
  4. Django redirecting http -> https
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment