-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(routing): actions should redirect the original pathname #12173
Conversation
🦋 Changeset detectedLatest commit: d1fc9c2 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Didn't notice the tests are failing 🙈 Could be related to copying the request |
Most probably, yeah. I think it's fine to not try to copy the body, and copy the request normally. Let's see if that works |
b2e16a5
to
6b1d0e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fix looks great! The remaining fail seems expected from main
Co-authored-by: Bjorn Lu <[email protected]>
* fix(routing): actions should redirect the original pathname * decode header to avoid index out of bounds * fix e2e test * Update packages/astro/e2e/actions-blog.test.js Co-authored-by: Bjorn Lu <[email protected]> --------- Co-authored-by: Bjorn Lu <[email protected]>
…12235) Co-authored-by: Bjorn Lu <[email protected]>
Looks like I have similar crash in production:
astro: 4.16.7 |
Downgrade to 4.16.6 fixed |
Changes
Closes #12146
Closes PLT-2576
An Astro action uses
context.url.pathname
for its redirect, however this is a bug because when there's a rewrite, theAPIContext
gets updated in place when using `next(/payload/). Astro actions need to redirect to the same original URL where the initial request started.To fix the bug, we inject a well known header when we create
RenderContext
, so no matter how many rewrites happen, the original pathname is always there and the sameTesting
Created a new e2e test
Docs
N/A