-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Support overriding request headers in middlewares #41380
Support overriding request headers in middlewares #41380
Conversation
Stats from current PRDefault Build (Increase detected
|
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
buildDuration | 36.7s | 36s | -757ms |
buildDurationCached | 8.7s | 8.9s | |
nodeModulesSize | 105 MB | 105 MB | |
nextStartRea..uration (ms) | 280ms | 273ms | -7ms |
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
328.HASH.js gzip | 179 B | 185 B | |
869-HASH.js gzip | 11.6 kB | 11.6 kB | |
app-internal..HASH.js gzip | 182 B | 182 B | ✓ |
main-app-HASH.js gzip | 98.7 kB | 98.7 kB | |
main-HASH.js gzip | 76.8 kB | 76.8 kB | -1 B |
webpack-HASH.js gzip | 1.83 kB | 1.83 kB | |
Overall change | 189 kB | 189 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
_app-HASH.js gzip | 191 B | 192 B | |
_error-HASH.js gzip | 179 B | 176 B | -3 B |
amp-HASH.js gzip | 482 B | 484 B | |
css-HASH.js gzip | 800 B | 802 B | |
dynamic-HASH.js gzip | 2.3 kB | 2.3 kB | -1 B |
edge-ssr-HASH.js gzip | 256 B | 259 B | |
head-HASH.js gzip | 828 B | 826 B | -2 B |
hooks-HASH.js gzip | 849 B | 849 B | ✓ |
image-HASH.js gzip | 3.98 kB | 3.98 kB | -1 B |
index-HASH.js gzip | 252 B | 254 B | |
link-HASH.js gzip | 2.73 kB | 2.73 kB | |
routerDirect..HASH.js gzip | 782 B | 778 B | -4 B |
script-HASH.js gzip | 859 B | 856 B | -3 B |
withRouter-HASH.js gzip | 781 B | 780 B | -1 B |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 15.4 kB | 15.4 kB | -2 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
_buildManifest.js gzip | 480 B | 483 B | |
Overall change | 480 B | 483 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
index.html gzip | 490 B | 490 B | ✓ |
link.html gzip | 504 B | 505 B | |
withRouter.html gzip | 484 B | 485 B | |
Overall change | 1.48 kB | 1.48 kB |
Edge SSR bundle Size Overall increase ⚠️
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
edge-ssr.js gzip | 61.3 kB | 61.4 kB | |
page.js gzip | 95.5 kB | 95.6 kB | |
Overall change | 157 kB | 157 kB |
Middleware size Overall increase ⚠️
vercel/next.js canary | nuta/next.js middleware-request-headers-manipulation | Change | |
---|---|---|---|
middleware-b..fest.js gzip | 566 B | 570 B | |
middleware-r..fest.js gzip | 143 B | 145 B | |
middleware.js gzip | 25.2 kB | 25.4 kB | |
edge-runtime..pack.js gzip | 2.21 kB | 2.21 kB | ✓ |
Overall change | 28.1 kB | 28.4 kB |
Diffs
Diff for page.js
Diff too large to display
Diff for middleware-b..-manifest.js
@@ -7,80 +7,80 @@ self.__BUILD_MANIFEST = {
"static/BUILD_ID/_ssgManifest.js"
],
rootMainFiles: [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-app-c22644611192a9c2.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-app-55b09adc090d299b.js"
],
pages: {
"/": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/index-7ccd1b1930c4d505.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/index-d039610ac387a1a2.js"
],
"/_app": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/_app-b1aa9bc9bb533b76.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/_app-3c08c46a4f81c30f.js"
],
"/_error": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/_error-77faf523f7dc719f.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/_error-b39849bd87f6201c.js"
],
"/amp": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/amp-f6d913b1595b4bda.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/amp-9395ec0994a9d6eb.js"
],
"/css": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
"static/css/94fdbc56eafa2039.css",
- "static/chunks/pages/css-352d0237482bebda.js"
+ "static/chunks/pages/css-3a075db0736f05e7.js"
],
"/dynamic": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/dynamic-b739be0a49287306.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/dynamic-90075b4c21021b3e.js"
],
"/edge-ssr": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/edge-ssr-51ea5deb6c2a65b3.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/edge-ssr-3261abe9cc912fa4.js"
],
"/head": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/head-61934f59d0339a54.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/head-9b6b3b9d22946395.js"
],
"/hooks": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/hooks-9e047c8dbc4ce238.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/hooks-b64051b6ffd303d7.js"
],
"/image": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/image-32c502a02b84af1c.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/image-0b8da099f740d47e.js"
],
"/link": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/link-5fa8d1451f7b64eb.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/link-fbc73d8c60483d1f.js"
],
"/routerDirect": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/routerDirect-46e61e002d5fd6ae.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/routerDirect-1e5f0e87b060242d.js"
],
"/script": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/script-79a818b59c0dd2a9.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/script-0cd1c9f84d9592a8.js"
],
"/withRouter": [
- "static/chunks/webpack-829bbf92fdb9b310.js",
- "static/chunks/main-7d4f98f8e596f93a.js",
- "static/chunks/pages/withRouter-1bdb810c596673f9.js"
+ "static/chunks/webpack-8e0ccd672aaf39e5.js",
+ "static/chunks/main-b5aa9ec268610c20.js",
+ "static/chunks/pages/withRouter-2a904d5d78caadaf.js"
]
},
ampFirstPages: []
Diff for middleware-r..-manifest.js
@@ -1,6 +1,6 @@
self.__REACT_LOADABLE_MANIFEST = {
"dynamic.js -> ../components/hello": {
- id: 328,
- files: ["static/chunks/328.93264405bfc4d5a0.js"]
+ id: 3258,
+ files: ["static/chunks/258.52c48025b4679c71.js"]
}
};
Diff for middleware.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[826],
{
- /***/ 8086: /***/ (
+ /***/ 7462: /***/ (
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -14,7 +14,7 @@
__webpack_require__.d(__webpack_exports__, {
default: () =>
/* binding */ next_middleware_loaderabsolutePagePath_private_next_root_dir_2Fmiddleware_js_page_2Fmiddleware_rootDir_2Ftmp_2Fnext_stats_2Fstats_app_matchers_
- }); // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/error.js
+ }); // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/error.js
class PageSignatureError extends Error {
constructor({ page }) {
@@ -41,7 +41,7 @@
Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
`);
}
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/utils.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/utils.js
//# sourceMappingURL=error.js.map
function fromNodeHeaders(object) {
@@ -155,7 +155,7 @@
}
);
}
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js
//# sourceMappingURL=utils.js.map
const responseSymbol = Symbol("response");
@@ -201,7 +201,7 @@
page: this.sourcePage
});
}
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js
//# sourceMappingURL=fetch-event.js.map
function detectDomainLocale(domainItems, hostname, detectedLocale) {
@@ -230,7 +230,7 @@
}
}
return domainItem;
- } //# sourceMappingURL=detect-domain-locale.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js
+ } //# sourceMappingURL=detect-domain-locale.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js
/**
* Removes the trailing slash for a given route or page path. Preserves the
@@ -240,7 +240,7 @@
* - `/` -> `/`
*/ function removeTrailingSlash(route) {
return route.replace(/\/$/, "") || "/";
- } //# sourceMappingURL=remove-trailing-slash.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js
+ } //# sourceMappingURL=remove-trailing-slash.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js
/**
* Given a path this function will find the pathname, query and hash and return
@@ -268,7 +268,7 @@
query: "",
hash: ""
};
- } //# sourceMappingURL=parse-path.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js
+ } //# sourceMappingURL=parse-path.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js
/**
* Adds the provided prefix to the given path. It first ensures that the path
@@ -279,7 +279,7 @@
}
const { pathname, query, hash } = parsePath(path);
return `${prefix}${pathname}${query}${hash}`;
- } //# sourceMappingURL=add-path-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js
+ } //# sourceMappingURL=add-path-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js
/**
* Similarly to `addPathPrefix`, this function adds a suffix at the end on the
@@ -291,7 +291,7 @@
}
const { pathname, query, hash } = parsePath(path);
return `${pathname}${suffix}${query}${hash}`;
- } //# sourceMappingURL=add-path-suffix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js
+ } //# sourceMappingURL=add-path-suffix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js
/**
* Checks if a given path starts with a given prefix. It ensures it matches
@@ -305,7 +305,7 @@
}
const { pathname } = parsePath(path);
return pathname === prefix || pathname.startsWith(prefix + "/");
- } //# sourceMappingURL=path-has-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js
+ } //# sourceMappingURL=path-has-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js
/**
* For a given path and a locale, if the locale is given, it will prefix the
@@ -322,7 +322,7 @@
return addPathPrefix(path, `/${locale}`);
}
return path;
- } //# sourceMappingURL=add-locale.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js
+ } //# sourceMappingURL=add-locale.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js
function formatNextPathnameInfo(info) {
let pathname = addLocale(
@@ -346,7 +346,7 @@
? addPathSuffix(pathname, "/")
: pathname
: removeTrailingSlash(pathname);
- } //# sourceMappingURL=format-next-pathname-info.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/get-hostname.js
+ } //# sourceMappingURL=format-next-pathname-info.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/get-hostname.js
/**
* Takes an object with a hostname property (like a parsed URL) and some
@@ -361,7 +361,7 @@
parsed.hostname) == null
? void 0
: ref.split(":")[0].toLowerCase();
- } //# sourceMappingURL=get-hostname.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js
+ } //# sourceMappingURL=get-hostname.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js
/**
* For a pathname that may include a locale from a list of locales, it
@@ -391,7 +391,7 @@
pathname,
detectedLocale
};
- } //# sourceMappingURL=normalize-locale-path.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js
+ } //# sourceMappingURL=normalize-locale-path.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js
/**
* Given a path and a prefix it will remove the prefix when it exists in the
@@ -407,7 +407,7 @@
: `/${withoutPrefix}`;
}
return path;
- } //# sourceMappingURL=remove-path-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js
+ } //# sourceMappingURL=remove-path-prefix.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js
function getNextPathnameInfo(pathname, options) {
var _nextConfig;
@@ -444,7 +444,7 @@
info.pathname;
}
return info;
- } //# sourceMappingURL=get-next-pathname-info.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/next-url.js
+ } //# sourceMappingURL=get-next-pathname-info.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/next-url.js
const REGEX_LOCALHOST_HOSTNAME = /(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1|localhost)/;
function parseURL(url, base) {
@@ -656,9 +656,9 @@
}
//# sourceMappingURL=next-url.js.map
- // EXTERNAL MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/compiled/cookie/index.js
- var cookie = __webpack_require__(1948);
- var cookie_default = /*#__PURE__*/ __webpack_require__.n(cookie); // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/cookies.js
+ // EXTERNAL MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/compiled/cookie/index.js
+ var cookie = __webpack_require__(965);
+ var cookie_default = /*#__PURE__*/ __webpack_require__.n(cookie); // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/cookies.js
const normalizeCookieOptions = options => {
options = Object.assign({}, options);
if (options.maxAge) {
@@ -777,7 +777,7 @@
this.response.headers.set("set-cookie", expiredCookies);
return super.clear();
};
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/request.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/request.js
//# sourceMappingURL=cookies.js.map
const INTERNALS = Symbol("internal request");
@@ -851,11 +851,31 @@
get url() {
return this[INTERNALS].url.toString();
}
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/response.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/spec-extension/response.js
//# sourceMappingURL=request.js.map
const response_INTERNALS = Symbol("internal response");
const REDIRECTS = new Set([301, 302, 303, 307, 308]);
+ function handleMiddlewareField(init, headers) {
+ var ref;
+ if (
+ init == null
+ ? void 0
+ : (ref = init.request) == null
+ ? void 0
+ : ref.headers
+ ) {
+ if (!(init.request.headers instanceof Headers)) {
+ throw new Error("request.headers must be an instance of Headers");
+ }
+ const keys = [];
+ for (const [key, value] of init.request.headers) {
+ headers.set("x-middleware-request-" + key, value);
+ keys.push(key);
+ }
+ headers.set("x-middleware-override-headers", keys.join(","));
+ }
+ }
class NextResponse extends Response {
constructor(body, init = {}) {
super(body, init);
@@ -916,6 +936,7 @@
static rewrite(destination, init) {
const headers = new Headers(init == null ? void 0 : init.headers);
headers.set("x-middleware-rewrite", validateURL(destination));
+ handleMiddlewareField(init, headers);
return new NextResponse(null, {
...init,
headers
@@ -924,12 +945,13 @@
static next(init) {
const headers = new Headers(init == null ? void 0 : init.headers);
headers.set("x-middleware-next", "1");
+ handleMiddlewareField(init, headers);
return new NextResponse(null, {
...init,
headers
});
}
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js
//# sourceMappingURL=response.js.map
/**
@@ -943,7 +965,7 @@
return `${relative.protocol}//${relative.host}` === origin
? relative.toString().replace(origin, "")
: relative.toString();
- } //# sourceMappingURL=relativize-url.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/internal-utils.js
+ } //# sourceMappingURL=relativize-url.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/internal-utils.js
const INTERNAL_QUERY_NAMES = [
"__nextFallback",
@@ -972,7 +994,7 @@
}
}
return searchParams;
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js
//# sourceMappingURL=internal-utils.js.map
// remove (name) from pathname as it's not considered for routing
@@ -996,7 +1018,7 @@
}
function normalizeRscPath(pathname, enabled) {
return enabled ? pathname.replace(/\.rsc($|\?)/, "") : pathname;
- } //# sourceMappingURL=app-paths.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/adapter.js
+ } //# sourceMappingURL=app-paths.js.map // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/esm/server/web/adapter.js
class NextRequestHint extends NextRequest {
constructor(params) {
@@ -1218,12 +1240,12 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
enumerable: false,
configurable: false
});
- } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+main-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js?absolutePagePath=private-next-root-dir%2Fmiddleware.js&page=%2Fmiddleware&rootDir=%2Ftmp%2Fnext-stats%2Fstats-app&matchers=!
+ } // CONCATENATED MODULE: ./node_modules/.pnpm/file+..+diff-repo+packages+next+next-packed.tgz_bah4pvzs5m2jsombgoz6nngonm/node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js?absolutePagePath=private-next-root-dir%2Fmiddleware.js&page=%2Fmiddleware&rootDir=%2Ftmp%2Fnext-stats%2Fstats-app&matchers=!
//# sourceMappingURL=adapter.js.map
enhanceGlobals();
- var mod = __webpack_require__(8452);
+ var mod = __webpack_require__(5941);
var handler = mod.middleware || mod.default;
if (typeof handler !== "function") {
@@ -1247,7 +1269,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 8452: /***/ (
+ /***/ 5941: /***/ (
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -1259,7 +1281,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/* harmony export */
});
/* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 8646
+ 253
);
/* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(
next_server__WEBPACK_IMPORTED_MODULE_0__
@@ -1272,7 +1294,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 6520: /***/ (__unused_webpack_module, exports) => {
+ /***/ 6961: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1292,7 +1314,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 891: /***/ (__unused_webpack_module, exports) => {
+ /***/ 1137: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1330,7 +1352,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 6568: /***/ (__unused_webpack_module, exports) => {
+ /***/ 3750: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1362,7 +1384,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 4601: /***/ (
+ /***/ 500: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1373,8 +1395,8 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.addLocale = addLocale;
- var _addPathPrefix = __webpack_require__(6325);
- var _pathHasPrefix = __webpack_require__(2180);
+ var _addPathPrefix = __webpack_require__(209);
+ var _pathHasPrefix = __webpack_require__(5249);
function addLocale(path, locale, defaultLocale, ignorePrefix) {
if (
locale &&
@@ -1394,7 +1416,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 6325: /***/ (
+ /***/ 209: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1405,7 +1427,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.addPathPrefix = addPathPrefix;
- var _parsePath = __webpack_require__(3444);
+ var _parsePath = __webpack_require__(7990);
function addPathPrefix(path, prefix) {
if (!path.startsWith("/") || !prefix) {
return path;
@@ -1417,7 +1439,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 7864: /***/ (
+ /***/ 3218: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1428,7 +1450,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.addPathSuffix = addPathSuffix;
- var _parsePath = __webpack_require__(3444);
+ var _parsePath = __webpack_require__(7990);
function addPathSuffix(path, suffix) {
if (!path.startsWith("/") || !suffix) {
return path;
@@ -1440,7 +1462,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3270: /***/ (
+ /***/ 3621: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1451,10 +1473,10 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.formatNextPathnameInfo = formatNextPathnameInfo;
- var _removeTrailingSlash = __webpack_require__(4335);
- var _addPathPrefix = __webpack_require__(6325);
- var _addPathSuffix = __webpack_require__(7864);
- var _addLocale = __webpack_require__(4601);
+ var _removeTrailingSlash = __webpack_require__(1127);
+ var _addPathPrefix = __webpack_require__(209);
+ var _addPathSuffix = __webpack_require__(3218);
+ var _addLocale = __webpack_require__(500);
function formatNextPathnameInfo(info) {
let pathname = (0, _addLocale).addLocale(
info.pathname,
@@ -1485,20 +1507,16 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 9635: /***/ (
- __unused_webpack_module,
- exports,
- __webpack_require__
- ) => {
+ /***/ 26: /***/ (__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getNextPathnameInfo = getNextPathnameInfo;
- var _normalizeLocalePath = __webpack_require__(6568);
- var _removePathPrefix = __webpack_require__(1068);
- var _pathHasPrefix = __webpack_require__(2180);
+ var _normalizeLocalePath = __webpack_require__(3750);
+ var _removePathPrefix = __webpack_require__(5084);
+ var _pathHasPrefix = __webpack_require__(5249);
function getNextPathnameInfo(pathname, options) {
var _nextConfig;
const { basePath, i18n, trailingSlash } =
@@ -1548,7 +1566,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3444: /***/ (__unused_webpack_module, exports) => {
+ /***/ 7990: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1582,7 +1600,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 2180: /***/ (
+ /***/ 5249: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1593,7 +1611,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.pathHasPrefix = pathHasPrefix;
- var _parsePath = __webpack_require__(3444);
+ var _parsePath = __webpack_require__(7990);
function pathHasPrefix(path, prefix) {
if (typeof path !== "string") {
return false;
@@ -1605,7 +1623,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 1068: /***/ (
+ /***/ 5084: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -1616,7 +1634,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
});
exports.removePathPrefix = removePathPrefix;
- var _pathHasPrefix = __webpack_require__(2180);
+ var _pathHasPrefix = __webpack_require__(5249);
function removePathPrefix(path, prefix) {
if ((0, _pathHasPrefix).pathHasPrefix(path, prefix)) {
const withoutPrefix = path.slice(prefix.length);
@@ -1630,7 +1648,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 4335: /***/ (__unused_webpack_module, exports) => {
+ /***/ 1127: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1644,7 +1662,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 1948: /***/ module => {
+ /***/ 965: /***/ module => {
var __dirname = "/";
(() => {
"use strict";
@@ -1772,7 +1790,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3980: /***/ (module, exports, __webpack_require__) => {
+ /***/ 4803: /***/ (module, exports, __webpack_require__) => {
var __dirname = "/";
var __WEBPACK_AMD_DEFINE_RESULT__;
(() => {
@@ -2614,7 +2632,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3975: /***/ (__unused_webpack_module, exports) => {
+ /***/ 6140: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -2655,7 +2673,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 130: /***/ (
+ /***/ 7329: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -2665,10 +2683,10 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
Object.defineProperty(exports, "__esModule", {
value: true
});
- var _detectDomainLocale = __webpack_require__(891);
- var _formatNextPathnameInfo = __webpack_require__(3270);
- var _getHostname = __webpack_require__(6520);
- var _getNextPathnameInfo = __webpack_require__(9635);
+ var _detectDomainLocale = __webpack_require__(1137);
+ var _formatNextPathnameInfo = __webpack_require__(3621);
+ var _getHostname = __webpack_require__(6961);
+ var _getNextPathnameInfo = __webpack_require__(26);
const REGEX_LOCALHOST_HOSTNAME = /(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1|localhost)/;
function parseURL(url, base) {
return new URL(
@@ -2888,7 +2906,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3265: /***/ (
+ /***/ 1552: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -2898,7 +2916,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
Object.defineProperty(exports, "__esModule", {
value: true
});
- var _cookie = _interopRequireDefault(__webpack_require__(1948));
+ var _cookie = _interopRequireDefault(__webpack_require__(965));
function _interopRequireDefault(obj) {
return obj && obj.__esModule
? obj
@@ -3033,7 +3051,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 3371: /***/ (
+ /***/ 6751: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -3045,10 +3063,10 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
value: true
};
__webpack_unused_export__ = void 0;
- var _nextUrl = __webpack_require__(130);
- var _utils = __webpack_require__(1657);
- var _error = __webpack_require__(3975);
- var _cookies = __webpack_require__(3265);
+ var _nextUrl = __webpack_require__(7329);
+ var _utils = __webpack_require__(4867);
+ var _error = __webpack_require__(6140);
+ var _cookies = __webpack_require__(1552);
const INTERNALS = Symbol("internal request");
__webpack_unused_export__ = INTERNALS;
class NextRequest extends Request {
@@ -3129,7 +3147,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 9062: /***/ (
+ /***/ 1244: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -3140,11 +3158,31 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
__webpack_unused_export__ = {
value: true
};
- var _nextUrl = __webpack_require__(130);
- var _utils = __webpack_require__(1657);
- var _cookies = __webpack_require__(3265);
+ var _nextUrl = __webpack_require__(7329);
+ var _utils = __webpack_require__(4867);
+ var _cookies = __webpack_require__(1552);
const INTERNALS = Symbol("internal response");
const REDIRECTS = new Set([301, 302, 303, 307, 308]);
+ function handleMiddlewareField(init, headers) {
+ var ref;
+ if (
+ init == null
+ ? void 0
+ : (ref = init.request) == null
+ ? void 0
+ : ref.headers
+ ) {
+ if (!(init.request.headers instanceof Headers)) {
+ throw new Error("request.headers must be an instance of Headers");
+ }
+ const keys = [];
+ for (const [key, value] of init.request.headers) {
+ headers.set("x-middleware-request-" + key, value);
+ keys.push(key);
+ }
+ headers.set("x-middleware-override-headers", keys.join(","));
+ }
+ }
class NextResponse extends Response {
constructor(body, init = {}) {
super(body, init);
@@ -3208,6 +3246,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
"x-middleware-rewrite",
(0, _utils).validateURL(destination)
);
+ handleMiddlewareField(init, headers);
return new NextResponse(null, {
...init,
headers
@@ -3216,6 +3255,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
static next(init) {
const headers = new Headers(init == null ? void 0 : init.headers);
headers.set("x-middleware-next", "1");
+ handleMiddlewareField(init, headers);
return new NextResponse(null, {
...init,
headers
@@ -3229,7 +3269,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 1264: /***/ (
+ /***/ 4112: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -3243,7 +3283,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
__webpack_unused_export__ = isBot;
exports.Nf = userAgentFromString;
exports.WE = userAgent;
- var _uaParserJs = _interopRequireDefault(__webpack_require__(3980));
+ var _uaParserJs = _interopRequireDefault(__webpack_require__(4803));
function _interopRequireDefault(obj) {
return obj && obj.__esModule
? obj
@@ -3271,7 +3311,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 1657: /***/ (__unused_webpack_module, exports) => {
+ /***/ 4867: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -3386,14 +3426,14 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
/***/
},
- /***/ 8646: /***/ (module, exports, __webpack_require__) => {
+ /***/ 253: /***/ (module, exports, __webpack_require__) => {
const serverExports = {
- NextRequest: __webpack_require__(3371) /* .NextRequest */.Im,
- NextResponse: __webpack_require__(9062) /* .NextResponse */.x,
+ NextRequest: __webpack_require__(6751) /* .NextRequest */.Im,
+ NextResponse: __webpack_require__(1244) /* .NextResponse */.x,
userAgentFromString: __webpack_require__(
- 1264
+ 4112
) /* .userAgentFromString */.Nf,
- userAgent: __webpack_require__(1264) /* .userAgent */.WE
+ userAgent: __webpack_require__(4112) /* .userAgent */.WE
};
if (typeof URLPattern !== "undefined") {
@@ -3419,7 +3459,7 @@ Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
// webpackRuntimeModules
/******/ var __webpack_exec__ = moduleId =>
__webpack_require__((__webpack_require__.s = moduleId));
- /******/ var __webpack_exports__ = __webpack_exec__(8086);
+ /******/ var __webpack_exports__ = __webpack_exec__(7462);
/******/ (_ENTRIES =
typeof _ENTRIES === "undefined"
? {}
Diff for edge-ssr.js
Diff too large to display
Diff for _buildManifest.js
@@ -1,28 +1,28 @@
self.__BUILD_MANIFEST = {
__rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
- "/": ["static\u002Fchunks\u002Fpages\u002Findex-7ccd1b1930c4d505.js"],
- "/_error": ["static\u002Fchunks\u002Fpages\u002F_error-77faf523f7dc719f.js"],
- "/amp": ["static\u002Fchunks\u002Fpages\u002Famp-f6d913b1595b4bda.js"],
+ "/": ["static\u002Fchunks\u002Fpages\u002Findex-d039610ac387a1a2.js"],
+ "/_error": ["static\u002Fchunks\u002Fpages\u002F_error-b39849bd87f6201c.js"],
+ "/amp": ["static\u002Fchunks\u002Fpages\u002Famp-9395ec0994a9d6eb.js"],
"/css": [
"static\u002Fcss\u002F94fdbc56eafa2039.css",
- "static\u002Fchunks\u002Fpages\u002Fcss-352d0237482bebda.js"
+ "static\u002Fchunks\u002Fpages\u002Fcss-3a075db0736f05e7.js"
],
"/dynamic": [
- "static\u002Fchunks\u002Fpages\u002Fdynamic-b739be0a49287306.js"
+ "static\u002Fchunks\u002Fpages\u002Fdynamic-90075b4c21021b3e.js"
],
"/edge-ssr": [
- "static\u002Fchunks\u002Fpages\u002Fedge-ssr-51ea5deb6c2a65b3.js"
+ "static\u002Fchunks\u002Fpages\u002Fedge-ssr-3261abe9cc912fa4.js"
],
- "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-61934f59d0339a54.js"],
- "/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-9e047c8dbc4ce238.js"],
- "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-32c502a02b84af1c.js"],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-5fa8d1451f7b64eb.js"],
+ "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-9b6b3b9d22946395.js"],
+ "/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-b64051b6ffd303d7.js"],
+ "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-0b8da099f740d47e.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-fbc73d8c60483d1f.js"],
"/routerDirect": [
- "static\u002Fchunks\u002Fpages\u002FrouterDirect-46e61e002d5fd6ae.js"
+ "static\u002Fchunks\u002Fpages\u002FrouterDirect-1e5f0e87b060242d.js"
],
- "/script": ["static\u002Fchunks\u002Fpages\u002Fscript-79a818b59c0dd2a9.js"],
+ "/script": ["static\u002Fchunks\u002Fpages\u002Fscript-0cd1c9f84d9592a8.js"],
"/withRouter": [
- "static\u002Fchunks\u002Fpages\u002FwithRouter-1bdb810c596673f9.js"
+ "static\u002Fchunks\u002Fpages\u002FwithRouter-2a904d5d78caadaf.js"
],
sortedPages: [
"\u002F",
Diff for _app-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[888],
{
- /***/ 8351: /***/ function(
+ /***/ 7006: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/_app",
function() {
- return __webpack_require__(9836);
+ return __webpack_require__(2728);
}
]);
if (false) {
@@ -24,7 +24,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [179], function() {
- return __webpack_exec__(8351), __webpack_exec__(975);
+ return __webpack_exec__(7006), __webpack_exec__(7523);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for _error-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[820],
{
- /***/ 9548: /***/ function(
+ /***/ 3020: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/_error",
function() {
- return __webpack_require__(9586);
+ return __webpack_require__(28);
}
]);
if (false) {
@@ -24,7 +24,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(9548);
+ return __webpack_exec__(3020);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for amp-HASH.js
@@ -1,17 +1,17 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[216],
{
- /***/ 3485: /***/ function(
+ /***/ 7481: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
) {
- module.exports = __webpack_require__(4061);
+ module.exports = __webpack_require__(6286);
/***/
},
- /***/ 6530: /***/ function(
+ /***/ 2880: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -19,7 +19,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/amp",
function() {
- return __webpack_require__(1790);
+ return __webpack_require__(2331);
}
]);
if (false) {
@@ -28,7 +28,7 @@
/***/
},
- /***/ 4061: /***/ function(module, exports, __webpack_require__) {
+ /***/ 6286: /***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -37,9 +37,9 @@
exports.useAmp = useAmp;
var _interop_require_default = __webpack_require__(7022) /* ["default"] */
.Z;
- var _react = _interop_require_default(__webpack_require__(9453));
- var _ampContext = __webpack_require__(4075);
- var _ampMode = __webpack_require__(3298);
+ var _react = _interop_require_default(__webpack_require__(1058));
+ var _ampContext = __webpack_require__(3494);
+ var _ampMode = __webpack_require__(1422);
function useAmp() {
// Don't assign the context value to a variable to save bytes
return (0, _ampMode).isInAmpMode(
@@ -61,7 +61,7 @@
/***/
},
- /***/ 1790: /***/ function(
+ /***/ 2331: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -78,7 +78,7 @@
/* harmony export */
});
/* harmony import */ var next_amp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 3485
+ 7481
);
/* harmony import */ var next_amp__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(
next_amp__WEBPACK_IMPORTED_MODULE_0__
@@ -102,7 +102,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(6530);
+ return __webpack_exec__(2880);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for css-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[706],
{
- /***/ 631: /***/ function(
+ /***/ 1737: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/css",
function() {
- return __webpack_require__(51);
+ return __webpack_require__(7649);
}
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 51: /***/ function(
+ /***/ 7649: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -26,10 +26,10 @@
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 690
+ 1761
);
/* harmony import */ var _css_module_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
- 3636
+ 2551
);
/* harmony import */ var _css_module_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(
_css_module_css__WEBPACK_IMPORTED_MODULE_1__
@@ -49,14 +49,14 @@
/***/
},
- /***/ 3636: /***/ function(module) {
+ /***/ 2551: /***/ function(module) {
// extracted by mini-css-extract-plugin
module.exports = { helloWorld: "css_helloWorld__qqNwY" };
/***/
},
- /***/ 3561: /***/ function(
+ /***/ 6052: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -71,7 +71,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
- var f = __webpack_require__(9453),
+ var f = __webpack_require__(1058),
k = Symbol.for("react.element"),
l = Symbol.for("react.fragment"),
m = Object.prototype.hasOwnProperty,
@@ -106,7 +106,7 @@
/***/
},
- /***/ 690: /***/ function(
+ /***/ 1761: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
@@ -114,7 +114,7 @@
"use strict";
if (true) {
- module.exports = __webpack_require__(3561);
+ module.exports = __webpack_require__(6052);
} else {
}
@@ -127,7 +127,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(631);
+ return __webpack_exec__(1737);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for dynamic-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[739],
{
- /***/ 8963: /***/ function(
+ /***/ 9051: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/dynamic",
function() {
- return __webpack_require__(9318);
+ return __webpack_require__(1698);
}
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 2024: /***/ function(module, exports, __webpack_require__) {
+ /***/ 14: /***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -29,8 +29,8 @@
var _extends = __webpack_require__(5506) /* ["default"] */.Z;
var _interop_require_default = __webpack_require__(7022) /* ["default"] */
.Z;
- var _react = _interop_require_default(__webpack_require__(9453));
- var _loadable = _interop_require_default(__webpack_require__(2990));
+ var _react = _interop_require_default(__webpack_require__(1058));
+ var _loadable = _interop_require_default(__webpack_require__(1038));
function dynamic(dynamicOptions, options) {
let loadableFn = _loadable.default;
let loadableOptions = (options == null
@@ -128,7 +128,7 @@
/***/
},
- /***/ 135: /***/ function(
+ /***/ 5401: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -141,7 +141,7 @@
exports.LoadableContext = void 0;
var _interop_require_default = __webpack_require__(7022) /* ["default"] */
.Z;
- var _react = _interop_require_default(__webpack_require__(9453));
+ var _react = _interop_require_default(__webpack_require__(1058));
const LoadableContext = _react.default.createContext(null);
exports.LoadableContext = LoadableContext;
if (false) {
@@ -150,7 +150,7 @@
/***/
},
- /***/ 2990: /***/ function(
+ /***/ 1038: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -164,9 +164,9 @@
var _extends = __webpack_require__(5506) /* ["default"] */.Z;
var _interop_require_default = __webpack_require__(7022) /* ["default"] */
.Z;
- var _react = _interop_require_default(__webpack_require__(9453));
- var _loadableContext = __webpack_require__(135);
- const { useSyncExternalStore } = true ? __webpack_require__(9453) : 0;
+ var _react = _interop_require_default(__webpack_require__(1058));
+ var _loadableContext = __webpack_require__(5401);
+ const { useSyncExternalStore } = true ? __webpack_require__(1058) : 0;
const ALL_INITIALIZERS = [];
const READY_INITIALIZERS = [];
let initialized = false;
@@ -416,7 +416,7 @@
/***/
},
- /***/ 9318: /***/ function(
+ /***/ 1698: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -430,10 +430,10 @@
/* harmony export */
});
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 690
+ 1761
);
/* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
- 6706
+ 9477
);
/* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(
next_dynamic__WEBPACK_IMPORTED_MODULE_1__
@@ -442,11 +442,11 @@
const DynamicHello = next_dynamic__WEBPACK_IMPORTED_MODULE_1___default()(
() =>
__webpack_require__
- .e(/* import() */ 328)
- .then(__webpack_require__.bind(__webpack_require__, 328)),
+ .e(/* import() */ 258)
+ .then(__webpack_require__.bind(__webpack_require__, 3258)),
{
loadableGenerated: {
- webpack: () => [/*require.resolve*/ 328]
+ webpack: () => [/*require.resolve*/ 3258]
}
}
);
@@ -473,7 +473,7 @@
/***/
},
- /***/ 3561: /***/ function(
+ /***/ 6052: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -488,7 +488,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
- var f = __webpack_require__(9453),
+ var f = __webpack_require__(1058),
k = Symbol.for("react.element"),
l = Symbol.for("react.fragment"),
m = Object.prototype.hasOwnProperty,
@@ -523,7 +523,7 @@
/***/
},
- /***/ 690: /***/ function(
+ /***/ 1761: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
@@ -531,19 +531,19 @@
"use strict";
if (true) {
- module.exports = __webpack_require__(3561);
+ module.exports = __webpack_require__(6052);
} else {
}
/***/
},
- /***/ 6706: /***/ function(
+ /***/ 9477: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
) {
- module.exports = __webpack_require__(2024);
+ module.exports = __webpack_require__(14);
/***/
}
@@ -554,7 +554,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(8963);
+ return __webpack_exec__(9051);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for edge-ssr-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[800],
{
- /***/ 529: /***/ function(
+ /***/ 3839: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/edge-ssr",
function() {
- return __webpack_require__(258);
+ return __webpack_require__(6726);
}
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 258: /***/ function(
+ /***/ 6726: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -50,7 +50,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(529);
+ return __webpack_exec__(3839);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for head-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[645],
{
- /***/ 8780: /***/ function(
+ /***/ 2116: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/head",
function() {
- return __webpack_require__(5835);
+ return __webpack_require__(8231);
}
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 5835: /***/ function(
+ /***/ 8231: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -32,10 +32,10 @@
/* harmony export */
});
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 690
+ 1761
);
/* harmony import */ var next_head__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
- 8722
+ 8631
);
/* harmony import */ var next_head__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(
next_head__WEBPACK_IMPORTED_MODULE_1__
@@ -69,7 +69,7 @@
/***/
},
- /***/ 3561: /***/ function(
+ /***/ 6052: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -84,7 +84,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
- var f = __webpack_require__(9453),
+ var f = __webpack_require__(1058),
k = Symbol.for("react.element"),
l = Symbol.for("react.fragment"),
m = Object.prototype.hasOwnProperty,
@@ -119,7 +119,7 @@
/***/
},
- /***/ 690: /***/ function(
+ /***/ 1761: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
@@ -127,19 +127,19 @@
"use strict";
if (true) {
- module.exports = __webpack_require__(3561);
+ module.exports = __webpack_require__(6052);
} else {
}
/***/
},
- /***/ 8722: /***/ function(
+ /***/ 8631: /***/ function(
module,
__unused_webpack_exports,
__webpack_require__
) {
- module.exports = __webpack_require__(1519);
+ module.exports = __webpack_require__(3488);
/***/
}
@@ -150,7 +150,7 @@
return __webpack_require__((__webpack_require__.s = moduleId));
};
/******/ __webpack_require__.O(0, [888, 179], function() {
- return __webpack_exec__(8780);
+ return __webpack_exec__(2116);
});
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for hooks-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[757],
{
- /***/ 4076: /***/ function(
+ /***/ 1042: /***/ function(
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/hooks",
function() {
- return __webpack_require__(9740);
+ return __webpack_require__(7568);
}
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 9740: /***/ function(
+ /***/ 7568: /***/ function(
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -26,10 +26,10 @@
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
- 690
+ 1761
);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
- 9453
+ 1058
);
/* harmony default export */ __webpack_exports__["default"] = () => {
@@ -77,7 +77,7 @@
/***/
},
- /***/ 3561: /***/ function(
+ /***/ 6052: /***/ function(
__unused_webpack_module,
exports,
__webpack_require__
@@ -92,7 +92,7 @@
* This source code is licensed u
Post job cleanup.
[command]/usr/bin/git version
git version 2.37.3
Temporarily overriding HOME='/home/runner/work/_temp/0ae160d8-8d3f-4069-8eef-4492519ea0e5' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/next.js/next.js
[command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
[command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
http.https://github.com/.extraheader
[command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
Cleaning up orphan processes
Commit: b4a0eb565273ac97d4f19e1c38851d6a252e328b
import { fetchViaHTTP } from 'next-test-utils' | ||
import { createNext, FileRef } from 'e2e-utils' | ||
|
||
describe('Middleware Request Headers Manipulation', () => { |
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.
Can you add a similar test for test/e2e/app-dir
? The new router relies on certain headers to be available and this change might cause accidentally breaking the application if it doesn't copy them over, especially in the Response.next(
case
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.
Added app
-based tests app-middleware
:
app-middleware
├── app
│ ├── layout.js
│ └── ssr-page.server.js
├── middleware.js
├── next.config.js
└── pages
└── api
├── dump-headers-edge.js
└── dump-headers-serverless.js
newbie question: Is gSSP like the following available in the Layout RFC? Wonder if a SSR page can still read request headers. If not I'll just remove this test.
export default function SSRPage({ headers }) {
return (
<>
<p id="headers">{JSON.stringify(headers)}</p>
</>
)
}
export const getServerSideProps = (ctx) => {
return {
props: {
headers: ctx.req.headers,
},
}
}
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.
Nvm I noticed next/headers
in the latest canary. Will update the failing test 😄
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.
Updated the test. It's ready for review 👍
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.
Nice work Seiya! A couple of questions.
test/e2e/middleware-request-header-manipulation/app/pages/ssr-page.js
Outdated
Show resolved
Hide resolved
test/e2e/middleware-request-header-manipulation/app/next.config.js
Outdated
Show resolved
Hide resolved
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.
Eager to use it! Thank you Seiya
Failing test suitesCommit: 0f4ffdd
Expand output● app-dir with middleware › Mutate request headers for getServerSideProps › Adds new headers
● app-dir with middleware › Mutate request headers for getServerSideProps › Deletes headers
● app-dir with middleware › Mutate request headers for getServerSideProps › Updates headers
Read more about building and testing Next.js in contributing.md. |
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> This PR adds a feature in middleware to add, modify, or delete request headers. This feature is quite useful to pass data from middleware to Serverless/Edge API routes. ### New APIs Adds a new option `request.headers` to the `MiddlewareResponseInit` parameter in `NextResponse.next()` and `NextResponse.rewrite()`. It's a [`Header`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object holding *all* request headers. Specifically: ```ts interface ExtraResponseInit extends ResponseInit { request?: { headers?: Headers } } ``` ### Example ```ts // api/hello.ts export default (req, res) => { const valueFromMiddleware = req.headers['x-hello-from-middleware'] return res.send(valueFromMiddleware) } // middleware.ts import { next } from '@vercel/edge' export default function middleware(request: NextRequest) { // Clone request headers const headers = new Headers(request.headers); // Add a new request header headers.set('x-hello-from-middleware', 'foo'); // Delete a request header from the client headers.delete('x-from-client'); return next({ request: { headers } }); } ``` ### New middleware headers - `x-middleware-override-headers`: A comma separated list of *all* request header names. Headers not listed will be deleted. - `x-middleware-request-<name>`: A new value for the header `<name>`. ### Related Issues - Next.js' implementation: vercel/next.js#41380 ### 📋 Checklist <!-- Please keep your PR as a Draft until the checklist is complete --> #### Tests - [ ] The code changed/added as part of this PR has been covered with tests - [ ] All tests pass locally with `yarn test-unit` #### Code Review - [ ] This PR has a concise title and thorough description useful to a reviewer - [ ] Issue from task tracker has a link to this PR Co-authored-by: Gal Schlezinger <[email protected]>
This PR adds a feature in middleware to add, modify, or delete request headers. This feature is quite useful to pass data from middleware to Serverless/Edge API routes. ### Questions for Reviewers - Should we deny modifying standard request headers like `Transfer-Encoding`? - Should we throw an error if the header is too large? Real-world HTTP servers will accept up to only 8KB - 32KB. ### New APIs Adds a new option `request.headers` to the `MiddlewareResponseInit` parameter in `NextResponse.next()` and `NextResponse.rewrite()`. It's a [`Header`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object holding *all* request headers. Specifically: ```ts interface MiddlewareResponseInit extends ResponseInit { request?: { headers?: Headers } } ``` ### Example ```ts // pages/api/hello.ts export default (req, res) => { const valueFromMiddleware = req.headers['x-hello-from-middleware'] return res.send(valueFromMiddleware) } // middleware.ts import { NextRequest, NextResponse } from 'next/server' export default function middleware(request: NextRequest) { // Clone request headers const headers = new Headers(request.headers); // Add a new request header headers.set('x-hello-from-middleware', 'foo'); // Delete a request header from the client headers.delete('x-from-client'); const resp = NextResponse.next({ // New option `request.headers` which accepts a Headers object // overrides request headers with the specified new ones. request: { headers } }); // You can still set *response* headers to the client, as before. resp.headers.set('x-hello-client', 'bar'); return resp; } ``` ### New middleware headers - `x-middleware-override-headers`: A comma separated list of *all* request header names. Headers not listed will be deleted. - `x-middleware-request-<name>`: A new value for the header `<name>`. ## Related Discussions - vercel#31188 - vercel#39300 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
We're seeing a bug in this with the new appDir. If we set an extra header in this way, we see full page reloads for navigations where |
Implements request headers override in middlewares. #### New middleware headers - `x-middleware-override-headers`: A comma separated list of *all* request header names. Headers not listed will be deleted. - `x-middleware-request-<name>`: A new value for the header `<name>`. ### Related Issues - #8724: Add helper functions for non-Next.js middlewares - vercel/next.js#41380: Next.js' implementation ### 📋 Checklist <!-- Please keep your PR as a Draft until the checklist is complete --> #### Tests - [ ] The code changed/added as part of this PR has been covered with tests - [ ] All tests pass locally with `yarn test-unit` #### Code Review - [ ] This PR has a concise title and thorough description useful to a reviewer - [ ] Issue from task tracker has a link to this PR
This PR adds a feature in middleware to add, modify, or delete request headers. This feature is quite useful to pass data from middleware to Serverless/Edge API routes.
Questions for Reviewers
Transfer-Encoding
?New APIs
Adds a new option
request.headers
to theMiddlewareResponseInit
parameter inNextResponse.next()
andNextResponse.rewrite()
. It's aHeader
object holding all request headers. Specifically:Example
New middleware headers
x-middleware-override-headers
: A comma separated list of all request header names. Headers not listed will be deleted.x-middleware-request-<name>
: A new value for the header<name>
.Related Discussions
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
pnpm lint