Skip to content

Commit 0e55bf5

Browse files
committed
🔒️(helm) allow server host and whitelist pod IP for health checks
In a Kubernetes environment, we need to whitelist the pod's IP address to allow health checks to pass. This ensures that Kubernetes liveness and readiness probes can access the application to verify its health.
1 parent 9f66f73 commit 0e55bf5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ and this project adheres to
1414
- 🌐(backend) add german translation #259
1515
- 🌐(frontend) Add German translation #255
1616
- ✨(frontend) Add a broadcast store #387
17-
- ✨(backend) config endpoint #425
17+
- ✨(backend) whitelist pod's IP address #443
1818

1919
## Changed
2020

src/backend/impress/settings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import os
1414
import tomllib
15+
from socket import gethostbyname, gethostname
1516

1617
from django.utils.translation import gettext_lazy as _
1718

@@ -649,7 +650,13 @@ class Production(Base):
649650
"""
650651

651652
# Security
652-
ALLOWED_HOSTS = values.ListValue(None)
653+
# Add allowed host from environment variables.
654+
# The machine hostname is added by default,
655+
# it makes the application pingable by a load balancer on the same machine by example
656+
ALLOWED_HOSTS = [
657+
*values.ListValue([], environ_name="ALLOWED_HOSTS"),
658+
gethostbyname(gethostname()),
659+
]
653660
CSRF_TRUSTED_ORIGINS = values.ListValue([])
654661
SECURE_BROWSER_XSS_FILTER = True
655662
SECURE_CONTENT_TYPE_NOSNIFF = True

0 commit comments

Comments
 (0)