From 2516d0fb3734de6e986aacebd73f6b99260cbd1b Mon Sep 17 00:00:00 2001 From: Ruslan Matkovsky Date: Wed, 14 Feb 2024 02:32:25 +0100 Subject: [PATCH] [sitecore-jss-nextjs] #607601: redirects middleware has been fixed when pattern has locale and target is absolute url --- CHANGELOG.md | 2 +- .../sitecore-jss-nextjs/src/middleware/redirects-middleware.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df67d7530b..f62a12be69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ Our versioning strategy is as follows: * `[templates/nextjs-sxa]` Fixed Image component when there is using Banner variant which set property background-image when image is empty. ([#1689](https://github.com/Sitecore/jss/pull/1689)) ([#1692](https://github.com/Sitecore/jss/pull/1692)) * `[templates/nextjs-sxa]` Fix feature `show Grid column` in Experience Editor. ([#1704](https://github.com/Sitecore/jss/pull/1704)) * `[sitecore-jss-nextjs] [templates/nextjs-xmcloud]` SDK initialization rejections are now correctly handled. Errors should no longer occur after getSDK() promises resolve when they shouldn't (for example, getting Events SDK in development environment) ([#1712](https://github.com/Sitecore/jss/pull/1712) [#1715](https://github.com/Sitecore/jss/pull/1715) [#1716](https://github.com/Sitecore/jss/pull/1716)) -* `[sitecore-jss-nextjs]` Fix redirects middleware for working with absolute url where is using site language context ([#1727](https://github.com/Sitecore/jss/pull/1727)) +* `[sitecore-jss-nextjs]` Fix redirects middleware for working with absolute url where is using site language context ([#1727](https://github.com/Sitecore/jss/pull/1727)) ([#1737](https://github.com/Sitecore/jss/pull/1737)) ### 🛠 Breaking Changes diff --git a/packages/sitecore-jss-nextjs/src/middleware/redirects-middleware.ts b/packages/sitecore-jss-nextjs/src/middleware/redirects-middleware.ts index 63b212cb84..31235b0a28 100644 --- a/packages/sitecore-jss-nextjs/src/middleware/redirects-middleware.ts +++ b/packages/sitecore-jss-nextjs/src/middleware/redirects-middleware.ts @@ -116,7 +116,6 @@ export class RedirectsMiddleware extends MiddlewareBase { if (REGEXP_ABSOLUTE_URL.test(existsRedirect.target)) { url.href = existsRedirect.target; - url.locale = req.nextUrl.locale; } else { const source = `${url.pathname}${url.search}`; url.search = existsRedirect.isQueryStringPreserved ? url.search : '';