Skip to content

Commit

Permalink
[SXA] Merge pull request #1165 from Sitecore/feature/531843-1
Browse files Browse the repository at this point in the history
[SXA] 531843: Make redirects case-insensitive
  • Loading branch information
illiakovalenko authored Sep 23, 2022
2 parents b3a5847 + ff944c4 commit 2486193
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ export class RedirectsMiddleware {

return redirects.find((redirect: RedirectInfo) => {
return (
(regexParser(redirect.pattern).test(req.nextUrl.pathname) ||
regexParser(redirect.pattern).test(`/${req.nextUrl.locale}${req.nextUrl.pathname}`)) &&
(redirect.locale ? redirect.locale === req.nextUrl.locale : true)
(regexParser(redirect.pattern.toLowerCase()).test(req.nextUrl.pathname.toLowerCase()) ||
regexParser(redirect.pattern.toLowerCase()).test(
`/${req.nextUrl.locale}${req.nextUrl.pathname}`.toLowerCase()
)) &&
(redirect.locale
? redirect.locale.toLowerCase() === req.nextUrl.locale.toLowerCase()
: true)
);
});
}
Expand Down

0 comments on commit 2486193

Please sign in to comment.