Skip to content

Commit

Permalink
fix: redirect should work locally and in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuebert committed May 30, 2024
1 parent f2f1316 commit b04e154
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ function testPaths() {
const serveHtmlWithFallbacks = async (res, parentDomain, subDomain, filePaths) => {
for (const filePath of filePaths) {
if (filePath.startsWith('redirect:')) {
res.redirect(302, path.join(parentDomain, subDomain, filePath.slice(9)));
filePath = process.env.ENV == 'dev' ?
path.join(parentDomain, subDomain, filePath.slice(9)) :
path.join('/', filePath.slice(9))
res.redirect(302, path);
return;
}
const fullPath = path.join(parentDomain, subDomain, filePath);
Expand Down

0 comments on commit b04e154

Please sign in to comment.