Question:
I deployed a Django App to AWS Elastic Beanstalk and I’m getting “Invalid HTTP_HOST header” error even when I’ve added it to my allowed hosts settings.
I’m getting this error:
1 2 |
Invalid HTTP_HOST header: 'recordings-env.kf4qfzaijd.us-west-2.elasticbeanstalk.com'. You may need to add 'recordings-env.kf4qfzaijd.us-west-2.elasticbeanstalk.com' to ALLOWED_HOSTS. |
This is what I have in my settings.py
settings.py
:
1 2 3 4 5 6 7 8 |
ALLOWED_HOSTS = [ '127.0.0.1', 'localhost', '.amazonaws.com', '.elasticbeanstalk.com', 'recordings-env.kf4qfzaijd.us-west-2.elasticbeanstalk.com', ] |
I think the problem is that my settings aren’t being updated, because isn’t working either if I put ALLOWED_HOSTS = ['*']
. I left DEBUG = True
and in request information I’m getting: ALLOWED_HOSTS: ['localhost']
after modifying it I run eb deploy without errors.
Answer:
I’ve realized that my changes wasn’t being deployed because I needed to commit first and I didn’t know that (my first time deploying to eb). So, that was the problem.