Skip to content

Commit 6fb284e

Browse files
committed
add a health check endpoint without redirects
1 parent 4db92ff commit 6fb284e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

homu/server.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,19 @@ def admin():
950950
return 'Unrecognized command'
951951

952952

953+
@get('/health')
954+
def health():
955+
return 'OK'
956+
957+
953958
def redirect_to_canonical_host():
954959
request_url = urllib.parse.urlparse(request.url)
955960
redirect_url = request_url
956961

962+
# Disable redirects on the health check endpoint.
963+
if request_url.path == "/health":
964+
return
965+
957966
# Handle hostname changes
958967
if "canonical_url" in g.cfg["web"]:
959968
canonical_url = urllib.parse.urlparse(g.cfg["web"]["canonical_url"])

0 commit comments

Comments
 (0)