forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support colons in Middleware NextResponse.rewrite path (vercel#32543)
* Add failing colon rewrite test * add test fixture * better colon rewrite tests * middleware rewrite colon tests with query parameters * fix vercel#31523 this addresses the symptom but the real systemic issue is that prepareDestination is called on rewrite/redirect URLs, which have no defined special behavior for colons and they should not be compiled at all * hack around prepareDestination to skip compiling x-middleware-rewrite this is a bit nicer than just escaping colons, but ideally we find a way to obviate prepareDestination * obviate prepareDestination for x-middleware-rewrite handling * don't clobber rewrite query data * omit redundant type * catch up to main * It looks like newUrl should contain only pathname Co-authored-by: Naoyuki Kanezawa <[email protected]>
- Loading branch information
Showing
4 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
12 changes: 12 additions & 0 deletions
12
test/integration/middleware/core/pages/rewrites/[param].js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const getServerSideProps = ({ params, query }) => { | ||
return { props: { params, query } } | ||
} | ||
|
||
export default function Page({ params: { param }, query: { qp } }) { | ||
return ( | ||
<> | ||
<p id="props">{param}</p> | ||
<p id="qp">{qp}</p> | ||
</> | ||
) | ||
} |
This file contains 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
This file contains 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