Describe the bug
Related: #595 and #13702.
I need to integrate a SvelteKit app into an existing Express.js server at a dynamic base path. Based on #595 (comment) I assume this is intended to be supported through the kit.paths.relative option, but trailing slash normalization seems to assume SvelteKit is top dog and redirects against the root.
Standard static paths.base behavior (repro branch)
With a configuration like this:
const config = {
kit: {
adapter: adapterNode(),
paths: {
base: '/sveltekit',
relative: true
}
}
}
...and integration into a custom server like this:
/sveltekit/sverdle/ is correctly redirected to /sveltekit/sverdle.
Dynamic paths.base attempt (repro branch)
With a configuration like this:
const config = {
kit: {
adapter: adapterNode(),
paths: {
relative: true
}
}
};
...and integration like this:
app.use('/sveltekit', handler);
/sveltekit/sverdle/ is incorrectly redirected to /sverdle.
Reproduction
HoldYourWaffle/sveltekit-express-dynamic-basepath, specifically repro--static-base and repro--dynamic-base.
System Info
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 16.98 GB / 31.81 GB
Binaries:
Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.6.2 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (133.0.3065.69)
Internet Explorer: 11.0.19041.4355
Severity
blocking all usage of SvelteKit
Additional Information
The Location header is allowed to be relative (MDN), so I think this should be an easy fix?™
Already working on a PR :)
Describe the bug
Related: #595 and #13702.
I need to integrate a SvelteKit app into an existing Express.js server at a dynamic base path. Based on #595 (comment) I assume this is intended to be supported through the
kit.paths.relativeoption, but trailing slash normalization seems to assume SvelteKit is top dog and redirects against the root.Standard static
paths.basebehavior (repro branch)With a configuration like this:
...and integration into a custom server like this:
/sveltekit/sverdle/is correctly redirected to/sveltekit/sverdle.Dynamic
paths.baseattempt (repro branch)With a configuration like this:
...and integration like this:
/sveltekit/sverdle/is incorrectly redirected to/sverdle.Reproduction
HoldYourWaffle/sveltekit-express-dynamic-basepath, specifically
repro--static-baseandrepro--dynamic-base.System Info
System: OS: Windows 10 10.0.19045 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 16.98 GB / 31.81 GB Binaries: Node: 22.14.0 - C:\Program Files\nodejs\node.EXE npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD pnpm: 10.6.2 - ~\AppData\Local\pnpm\pnpm.CMD Browsers: Edge: Chromium (133.0.3065.69) Internet Explorer: 11.0.19041.4355Severity
blocking all usage of SvelteKit
Additional Information
The
Locationheader is allowed to be relative (MDN), so I think this should be an easy fix?™Already working on a PR :)