What to do when "Invalid HTTP_HOST header" appears in Django

Event

Invalid HTTP_HOST header: '*.*.*.*:8000'. You may need to add '*.*.*.*' to ALLOWED_HOSTS.

error contents

Cause

settings.py


ALLOWED_HOSTS = []

Countermeasure ①

settings.py


ALLOWED_HOSTS = ['*']

Countermeasure ②

settings.py


ALLOWED_HOSTS = ['www.example.com']

Official documentation

Recommended Posts

What to do when "Invalid HTTP_HOST header" appears in Django
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
What to do when pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: appears
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
[Go 1.13] What to do when unexpected directory layout: appears
curl: (60) What to do when Issuer certificate is invalid.
What to do when a warning appears around Python integration in Neovim's CheckHealth
What to do when "TypeError: data type not understood" appears in python's numpy.zeros
What to do when [Errno 2] No such file or directory appears in Python
What to do when Ubuntu crashes
OSError: [Errno 40] What to do when Message too long appears
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do when the value type is ambiguous in Python?
How to do Server-Sent Events in Django
[Memorandum] What to do when a warning appears after executing pip list
What to do when the result downloaded via scrapy is in English
[Docker] What to do when error Couldn't find the binary git appears
What to do if No Python documentation found for ... appears in pydoc
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do when a warning message is displayed in pip list
What to do if pipreqs results in UnicodeDecodeError
What to do when PermissionError of tempfile.mkstemp occurs
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
What to do to get google spreadsheet in python
[python] What to do when an error occurs in send_keys of headless chrome
What to do when "TypeError: must be string, not int…" appears when using strptime
What to do when SSL error occurs in pip in Windows10, miniconda, VScode environment
[Python] What to check when you get a Unicode Decode Error in Django
What to do if abort is displayed when inputting camera video in OpenCV
What to do when the graph does not appear in jupyter (ipython) notebook
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What Django renders do
What to do when gdal_merge creates a huge file
What to do when raise ValueError, "unsupported hash type"
What to do if a UnicodeDecodeError occurs in pip
What to do when "cannot import name xxx" [Python]
Things to do when you start developing with Django
I want to do something in Python when I finish
What to do when you can't bind CaboCha to Python
What to do when is not in the sudoers file.This incident will be reported.
[Python] What to do when No module named'pyproj.datadir' appears when Exe is done with PyInstaller
What to do when only the window is displayed and nothing is displayed in pygame Note
What to do if you get an error when importing matplotlib in Python (Mac)
What to do when Python starts up in Anaconda does not come out unexpectedly
What to do when "Type Error: must be _socket.socket, not socket" appears on GAE
[AWS] What to do when you want to pip with Lambda
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do when Japanese is not displayed on matplotlib
How to update user information when logging in to Django RemoteUserMiddleware
What to do if pip gives a DistributionError in Homebrew
What to do when PyCharm font is strange or garbled
What to do when a Remove Error occurs when updating conda
What to do when there is no response due to Proxy setting in Python web scraping
What to do when Unalignable boolean Series provided as indexer
What to do when a Missing artifact occurs in a jar that is not defined in pom.xml
What to do if you get "coverage unknown" in Coveralls
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do when an error occurs with import _ssl
What to do if package installation fails when deploying to heroku