-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
rewrites.beforeFiles
should work the same with or without i18n
configuration.
#34371
Comments
We are experiencing the same issue.
|
I am facing the same issue that can be reproduced in the following sandbox: But, it's interesting that I am not able to reproduce the issue in NextJS monorepo running any of these two commands (dev and prod mode): next dev ./examples/basic-css/ or next build ./examples/basic-css/ && next start ./examples/basic-css/ Note: I've added What version of Next.js are you using? What version of Node.js are you using? What browser are you using? What operating system are you using? How are you deploying your application? next dev
next build && next start |
I am facing the same issue, needs to be fixed ASAP for the time being found a workaround using _middleware import { NextResponse } from "next/server";
const assetPrefixRegEx = new RegExp(`^${assetPrefix}`);
export default function middleware(request) {
const response = NextResponse.next();
if (assetPrefixRegEx.test(request.nextUrl.pathname)) {
request.nextUrl.pathname = request.nextUrl.pathname.replace(assetPrefixRegEx, "");
return NextResponse.rewrite(request.nextUrl);
}
return response;
} |
This should work by doing something like this 👍 {
source: '/:locale/base/:path*', // ignore locale
destination: '/:path*',
locale: false,
} |
Closing as the above has been documented in #37581 and we also added regression tests for this. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Run
next info
(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.11-canary.15
What version of Node.js are you using?
17.3.0
What browser are you using?
Firefox
What operating system are you using?
Linux
How are you deploying your application?
next start
Describe the Bug
Rewrites with
beforeFiles
does not work as it used to be withi18n
enabled. (last known to be working in next@11.1.2)Back in
next@11.1.2
I used to have thisrewrites
configuration:and my urls such as
/base/_next/static/chunks/main.js
used to work. (Use case: CDN shenanigans, CDN are configured to rewritesassets.xxx.com/foo/*
throughfoo.xxx.com/assets/*
for micro frontends.)Upon upgrading to
next@12.0.10
, this behavior does not work anymore.This bug does not occurs without
i18n
configured.I'm providing a PR with tests to confirm the broken behavior, although I've simplified the use case by using an image and not compiled file. Should I add a check for compiled files also?
Related: #23270
History: #23455
Expected Behavior
rewrites.beforeFiles
should work the same with or withouti18n
configuration.To Reproduce
#34370
The text was updated successfully, but these errors were encountered: