mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
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:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user