Skip to content

Commit 7745740

Browse files
tariqksolimandevin-ai-integration[bot]github-actions[bot]
authored
fix: prevent infinite redirect loop when ROOT_PATH is set (#950)
* fix: add curl to runtime stage for healthcheck support Co-Authored-By: tariq.k.soliman <tariqksoliman@gmail.com> * chore: bump version to 4.3.23-20260423 [version bump] * fix: prevent infinite redirect loop when ROOT_PATH is set When ROOT_PATH is set (e.g. /lunarsouthpole), Express non-strict route matching causes app.get(ROOT_PATH) to match both /lunarsouthpole and /lunarsouthpole/, creating an infinite 301 redirect loop. Add a guard so the redirect only fires when the request path does NOT already end with '/'. When it does, call next() to pass control to the main application route handler. Co-Authored-By: tariq.k.soliman <tariqksoliman@gmail.com> * chore: bump version to 4.3.24-20260423 [version bump] --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 34b8bc0 commit 7745740

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/server.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,12 @@ setups.getBackendSetups(function (setups) {
775775
// from the permissions.json file at the top of the file).
776776

777777
if (ROOT_PATH) {
778-
app.get(ROOT_PATH, (req, res) => {
779-
res.redirect(301, `${ROOT_PATH}/`);
778+
app.get(ROOT_PATH, (req, res, next) => {
779+
if (!req.path.endsWith('/')) {
780+
res.redirect(301, `${ROOT_PATH}/`);
781+
} else {
782+
next();
783+
}
780784
});
781785
}
782786

0 commit comments

Comments
 (0)