fix: skip FORCE_HTTPS redirect for /api/health endpoint

Health probes (K8s, Docker, LB health checks) hit the endpoint over plain
HTTP from inside the cluster/container. The catch-all HTTPS redirect was
causing all probe types to fail whenever FORCE_HTTPS=true was set.

Closes #735
This commit is contained in:
jubnl
2026-04-19 14:10:41 +02:00
parent 5978eec270
commit d0383c06c3
2 changed files with 18 additions and 2 deletions
+1
View File
@@ -112,6 +112,7 @@ export function createApp(): express.Application {
if (shouldForceHttps) {
app.use((req: Request, res: Response, next: NextFunction) => {
if (req.path === '/api/health') return next();
if (req.secure || req.headers['x-forwarded-proto'] === 'https') return next();
res.redirect(301, 'https://' + req.headers.host + req.url);
});