Repository navigation
fix: +redirects with a Base URL - #3615
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+redirects with a Base URL behind a server that passes a full URL+redirects](https://vike.dev/redirects) with a Base URL answered 500 behind Vike's built-in server, vike(app) or a +server.js
nitedani
marked this pull request as ready for review
October 15, 2026 00:18
67 of 73 tasks
+redirects](https://vike.dev/redirects) with a Base URL answered 500 behind Vike's built-in server, vike(app) or a +server.js+redirects with a Base URL
Member
|
Remove the test then squash-merge (use the PR title as the entire commit message). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With a Base URL, a
+redirectsentry answers 500 instead of 301 whenever the server passes Vike the full request URL, as Vike's built-in server,vike(app)and a+server.jsdo.+redirects: { '/old-portal': '/portal' },BASE=/app/mainGET /app/old-portal,+server: true,vike dev[vike@0.4.267][Bug] … at prependBase … at getPermanentRedirectlocation: http://localhost:3000/app/portalvike build,node dist/server/index.mjs[Bug]locationgetPermanentRedirect()passed the whole target URL, origin included, toprependBase(), which expects a path. It now prepends the Base URL to the pathname only, withmodifyUrlPathname(), which the function already uses a few lines above. A server that passes a path (vike devandvike previewwithout+server) gets the sameLocationas before.What you should see
1. A new run of
test/plusMiddlewares' Base URL tests with+server: trueinvike dev(.test-base-dev-server) fails onmainand passes here:It's the only test of a Base URL where Vike gets the full request URL, as it does behind its built-in server,
vike(app)and a+server.js.As brillout asked, 0ab0638 removes that test before merge; the fix itself is unchanged.
2. Production, with the query string kept:
🤖 Generated with Claude Code