'Invalid HTTP_HOST header: Amazon ec2 Django when debug=False

I am getting this error in my email after I made my server a production server.

I made debug = False and change DJANGO_SETTINGS_MODULE" in WSGI and manage from "config.settings.local to "config.settings.production. After that, I am getting these errors in my email

Invalid HTTP_HOST header: ip'xx.xxxx.xxx.xx'. You may need to add ip'xx.xxxx.xxx.xx' to ALLOWED_HOSTS. I have seen many similar questions but all are giving fixes to either add this to the Allowed host or don't send this error to email. But I want to know the cause of this.

My Question is

1- Why is the ec2 instance sending a request to the Django server?

2- Why errors are coming after I set my environment to Production?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source