ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS.-
A list of strings representing the host/domain names that this Django site can serve.
This is a security measure to prevent HTTP Host header attacks,
which are possible even under many seemingly-safe web server configurations.
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class HealthCheckMiddleware(MiddlewareMixin):
def process_request(self, request):
if request.META["PATH_INFO"] == "/ping/":
return HttpResponse("pong")