Ever since I deployed a site running Django 1.7 alpha (checked out from Git), I\'ve been occasionally receiving error messages with titles like:
\"Inv
Another way to block requests with an invalid Host header before it reaches Django is to use a default Apache config with a that does nothing but return a 404.
If you define this as your first virtual host (e.g. in 000-default.conf) and then follow it with your 'real' , complete with a and any <ServerAlias> entries that you want to match, Apache will return a 404 for any requests with a Host header that does not match or one of your entries. The key it to make sure that the default, 404 is defined first, either by filename ('000') or the first entry in your config file.
I like this better than the popular solution above because it is very explicit and easy to extend.