ALLOWED_HOSTS error

41 views
Skip to first unread message

Mike Dewhirst

unread,
Nov 21, 2022, 7:52:56 PM11/21/22
to Django users
My Django log is full of these errors ...

ERROR /usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py TIME: 2022-09-28 00:13:17,204 MSG: exception.py:response_for_exception:99 Invalid HTTP_HOST header: '111.222.333.444'. You may need to add '111.222.333.444' to ALLOWED_HOSTS.

... where '111.222.333.444. is the correct IP address of the FQDN for the site.

Everything seems to be working but these errors are just consuming disk space.

My reading of the docs https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts does not indicate the IP address should be in ALLOWED_HOSTS.

My inclination is it shouldn't be there.

What is the correct way to deal with this?

Many thanks

Mike

-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.
OpenPGP_signature

Lakshyaraj Dash

unread,
Nov 21, 2022, 7:55:08 PM11/21/22
to django...@googlegroups.com
Put only domain names in allowed hosts

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/053ab6dc-21c0-7914-1638-435838ace9ed%40dewhirst.com.au.

Mike Dewhirst

unread,
Nov 21, 2022, 8:12:36 PM11/21/22
to django...@googlegroups.com
On 22/11/2022 11:54 am, Lakshyaraj Dash wrote:
Put only domain names in allowed hosts

Thank you - that makes me feel better.

Can you tell me why the error is appearing? Is it some sort of hacking attempt?


OpenPGP_signature

Lakshyaraj Dash

unread,
Nov 21, 2022, 8:21:18 PM11/21/22
to django...@googlegroups.com
No,
Actually some ip addresses don't allow access to them directly. So you have to do it with a domain name.

Reply all
Reply to author
Forward
0 new messages