From ba7ed7976d861e724c1ae2e6ea7a144d65fbb52e Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Wed, 4 Dec 2024 01:48:41 -0800 Subject: [PATCH] enh: hoist firewall _api/health endpoint --- .../FirewallCommand/ServeCommand/firewall/server.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts b/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts index a35c37da..fff48d8a 100644 --- a/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts +++ b/packages/pockethost/src/cli/commands/FirewallCommand/ServeCommand/firewall/server.ts @@ -42,6 +42,12 @@ export const firewall = async () => { app.use(cors()) app.use(enforce.HTTPS()) + app.get(`/_api/health`, (req, res, next) => { + dbg(`Health check`) + res.json({ status: 'ok' }) + res.end() + }) + // Use the IP blocker middleware app.use(createIpWhitelistMiddleware(IPCIDR_LIST())) @@ -49,12 +55,6 @@ export const firewall = async () => { app.use(createVhostProxyMiddleware(host, target, IS_DEV())) }) - app.get(`/_api/health`, (req, res, next) => { - dbg(`Health check`) - res.json({ status: 'ok' }) - res.end() - }) - // Fall-through const handler = createProxyMiddleware({ target: `http://localhost:${DAEMON_PORT()}`,