django-drf-boilerplate icon indicating copy to clipboard operation
django-drf-boilerplate copied to clipboard

Create a health check endpoint that ignores ALLOWED_HOSTS check

Open smaniotto opened this issue 5 years ago • 2 comments

The default health check endpoint for load balancers normally is "/", which by default returns a 404, and it sends the request with an internal IP host, that is blocked by ALLOWED_HOSTS checking, returning a 403.

A suggestion is creating a "/health-check" endpoint that simply returns a 200 back and creating a middleware to ignore allowed host checking for this endpoint. Ideas?

smaniotto avatar Jan 07 '20 12:01 smaniotto

I think that we can close this issue since Fred has already implemented it @CheesecakeLabs/backend

I am just not so sure about what @smaniotto is suggesting in "creating a middleware to ignore allowed host checking for this endpoint"

rodolfolottin avatar Oct 22 '20 20:10 rodolfolottin

I think he means to not enforce the ALLOWED_HOSTS check on the "/health-check" endpoint. The suggestion is to implement it through a Middleware.

fredericojordan avatar Oct 27 '20 12:10 fredericojordan