Skip to content

Commit

Permalink
chore(SLB-449): redirect to status when not serving
Browse files Browse the repository at this point in the history
  • Loading branch information
colorfield authored and Leksat committed Aug 12, 2024
1 parent ad13679 commit 543ddad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/npm/@amazeelabs/publisher/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ const runServer = async (): Promise<HttpTerminator> => {

const servePort = getConfig().commands.serve?.port;
if (servePort) {
// Use the authentication middleware for the proxy.
app.use(
'/',
authMiddleware,
Expand All @@ -275,6 +276,12 @@ const runServer = async (): Promise<HttpTerminator> => {
target: `http://127.0.0.1:${servePort}`,
}),
);
} else {
// When not serving, redirect to the status
// that will use the authentication middleware if needed.
app.get('/', async (req, res) => {
res.redirect('/___status/');
});
}

const host = getConfig().publisherHost || '0.0.0.0';
Expand Down

0 comments on commit 543ddad

Please sign in to comment.