enh: hoist firewall _api/health endpoint

This commit is contained in:
Ben Allfree 2024-12-04 01:48:41 -08:00
parent a302c9ec86
commit ba7ed7976d

View File

@ -42,6 +42,12 @@ export const firewall = async () => {
app.use(cors()) app.use(cors())
app.use(enforce.HTTPS()) 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 // Use the IP blocker middleware
app.use(createIpWhitelistMiddleware(IPCIDR_LIST())) app.use(createIpWhitelistMiddleware(IPCIDR_LIST()))
@ -49,12 +55,6 @@ export const firewall = async () => {
app.use(createVhostProxyMiddleware(host, target, IS_DEV())) 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 // Fall-through
const handler = createProxyMiddleware({ const handler = createProxyMiddleware({
target: `http://localhost:${DAEMON_PORT()}`, target: `http://localhost:${DAEMON_PORT()}`,