[Answer]-Why am I getting an apache server error page on a django vhost using underscore in my subdomain?

1👍

Firstly, ALLOWED_HOSTS should be ignored altogether when you have DEBUG=True so that’s strange that you are getting validation errors.

I was having an issue similar to this with nginx where I had an underscore in my host name which meant Django didn’t validate it. This might be an issue particularly if you are having Apache rewriting your host header (this was the case for me as nginx was reverse proxying) or your subdomain includes an _.

You can see how Django validates hostnames in the source, furthermore, I wrote a quick blog post on this also which might help

Leave a comment