Recently, I upgrade one of my django sites from http to https. However, after that, I continuously receive Invalid HTTP_HOST header error email while before I n
This is probably because there may be bot scripts running which are targeting your server with different HTTP_HOST headers (this is common). and in django you have Allowed Hosts set to a particular host. So if a Host Header different from one specified in Allowed Hosts come then django would give 400 error.
By default django loggers are configured to send mail on each error. To stop getting the mails you need to configure loggers in django and add the
following logger
'django.security.DisallowedHost': {
'handlers': ['null'],
'propagate': False,
},
Refer https://www.calazan.com/how-to-disable-the-invalid-http_host-header-emails-in-django/