rsnext/packages/next/server
JJ Kasper 122899bd37
Add hard navigation guard and fix middleware rewrite cases (#37815)
This adds a guard for whenever we do a hard navigation over a client-navigation to ensure we aren't redirecting to the same URL that we are currently on as this can cause infinite redirecting. This also fixes some cases with middleware rewrites without i18n enabled and expands our middleware suite to test both with i18n and without. 

This also fixes a race condition with the query updating where a user could attempt a route transition and it then gets overridden by the query updating and prevents firing router events during the query updating as these can be false signals of a transition.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes: https://github.com/vercel/next.js/issues/37804
2022-06-20 11:31:19 +00:00
..
api-utils fix NextApiRequestCookies and NextApiRequestQuery types (#25532) 2022-05-23 00:48:26 +00:00
base-http Allow reading request bodies in middlewares (#34294) (#34519) 2022-02-18 19:43:43 +00:00
dev refactor(middleware): leverages edge-runtime builtins to decorate errors in dev (#37718) 2022-06-17 15:06:30 +00:00
lib chore: bump react dev dep to 18.2 (#37697) 2022-06-15 10:14:43 -05:00
send-payload Reduce the size of web server (#34767) 2022-02-24 19:53:17 +00:00
web Add hard navigation guard and fix middleware rewrite cases (#37815) 2022-06-20 11:31:19 +00:00
accept-header.ts Implement Middleware RFC (#30081) 2021-10-20 17:52:11 +00:00
app-render.tsx Strip next internal queries for flight response (#37617) 2022-06-10 20:08:24 +00:00
base-server.ts Refactor server routing (#37725) 2022-06-16 21:43:01 +00:00
body-streams.ts Allow Edge Functions to receive body (#37822) 2022-06-20 09:46:52 +00:00
config-shared.ts Add images.unoptimized: true for easy next export (#37698) 2022-06-16 20:20:17 +00:00
config-utils.ts Remove webpack 4 support (#29660) 2021-10-06 17:40:01 +02:00
config.ts fix(config): only warn experimental feature when used (#37755) 2022-06-18 07:44:37 -04:00
crypto-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
font-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-page-files.ts Add initial handling for routing tests (#36635) 2022-05-03 10:37:23 +00:00
get-route-from-entrypoint.ts Rename app paths folder (#37146) 2022-05-25 11:46:26 +02:00
htmlescape.ts Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
image-optimizer.ts Fix Image Optimization cache-control regression with external images (#37625) 2022-06-13 22:13:55 +00:00
load-components.ts Rename app paths folder (#37146) 2022-05-25 11:46:26 +02:00
next-server.ts Allow Edge Functions to receive body (#37822) 2022-06-20 09:46:52 +00:00
next.ts Fix react root env missing in NextServer (#37562) 2022-06-09 15:43:38 +02:00
node-polyfill-fetch.js Pre-compile more dependencies (#32742) 2022-01-17 15:17:22 +00:00
node-polyfill-web-streams.js Use Edge Runtime for running Edge Functions locally (#37024) 2022-05-30 12:01:36 +00:00
node-web-streams-helper.ts Update client router for tests (#36822) 2022-05-12 20:52:59 +00:00
optimize-amp.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
post-process.ts Enable html post optimization for react 18 (#36837) 2022-05-12 17:41:37 +00:00
render-result.ts Add unstable_useFlushEffects hook (#34117) 2022-02-18 00:18:28 +00:00
render.tsx Improve Middleware errors (#37695) 2022-06-14 19:58:13 -05:00
request-meta.ts Update to process redirects/rewrites for _next/data with middleware (#37574) 2022-06-10 12:35:12 -05:00
require.ts Ensure ENOENT error is not ignored when loading pages (#37486) 2022-06-06 14:35:26 -04:00
response-cache.ts Update to not trigger revalidation during prefetch (#37201) 2022-05-29 23:05:23 +00:00
router.ts Refactor server routing (#37725) 2022-06-16 21:43:01 +00:00
serve-static.ts Add support for AVIF to next/image (#29683) 2021-10-11 23:17:47 +00:00
server-route-utils.ts Refactor server routing (#37725) 2022-06-16 21:43:01 +00:00
utils.ts Strip next internal queries for flight response (#37617) 2022-06-10 20:08:24 +00:00
web-server.ts Rename app paths folder (#37146) 2022-05-25 11:46:26 +02:00