As the title says, deploys great with Health Check set to TCP, whole service works fine. But if Health Check is set to HTTP on / then gunicorn core.wsgi:application
gives 400.
My guess is it’s an ALLOWED_HOSTS issue. In the environment variables, it’s set to 127.0.0.1,localhost,<domain of app>
which works when deployed. But if Health Check is hitting a different domain, my guess is this won’t work?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
@timjdavey the only way I’ve found to get around this is to set ALLOWED_HOSTS = [‘*’]. Of course, this now means you are responsible for validating the host header.
Update, doing it with
DEBUG=True
I getdjango.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '10.244.4.235:8080'
. i.e. it’s hitting it from the IP of that dynamic instance. How do you get access to this IP so it can be added to the allowed hosts? gunicorn is running on 0.0.0.0:8080 so should allow internal IPs. I’ve tried most of the standard environmental variables but no joy.I’m not keen on relying on TCP as a health check. If this doesn’t work I’m moving back to render which seems to work magically out of the box for everything.