Created
December 29, 2020 10:20
-
-
Save mgax/cf771b1991e68ca454693d5f3597ff04 to your computer and use it in GitHub Desktop.
Health check with no HTTP Host header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponse | |
def health(get_response): | |
def middleware(request): | |
if request.path == "/health": | |
return HttpResponse("Healthy") | |
return get_response(request) | |
return middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIDDLEWARE = [ | |
'myapp.middleware.health', | |
# 'django.middleware.security.SecurityMiddleware', | |
# other middleware | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment