Django 400 Bad Request, even with Allowed Hosts

I just had to break down django itself to understand why I could not get rid of my error.

It turns out underscores in domain names is invalid according to the RFCs.

Make sure your domains do not have underscores. If they do, you’ll have to patch django’s host validation function:

host_validation_re = re.compile(r"^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9:]+\])(:\d+)?$")

1 Comment

Leave a reply to aRkadeFR (@aRkadeFR) Cancel reply