-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
change default _next in request path into something custom #31718
Comments
Do you have any workaround for that |
We have a similar need. There are server stacks where internally urls are routed to specific micro-service by using certain url prefix, requiring fully-customizable paths in web application framework. |
we need it too! |
Hi, what is the user case for this? It seems like |
I have also this problem with the following config. /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
assetPrefix: "/custom",
async rewrites() {
return [
{ source: "/custom/_next/:path*", destination: "/_next/:path*" },
{ source: "/custom/api/:path*", destination: "/api/:path*" }
];
},
i18n: { locales: ["en", "it"], defaultLocale: "en" }
};
module.exports = nextConfig;
I've done some tests and it appears that |
we want to integration the next page in android. but the underscore cause the assets loading run into error. |
@ijjk It doesn't work for us mui/mui-toolpad#660 because it also rewrites the links https://nextjs.org/docs/api-reference/next.config.js/basepath#links. Without this behavior, I suspect that it would work well. These link rewrites cause two problems for us 1. we can't work/reason with the URLs as if we were under the root folder. 2. some of the links that we import can't be changed, they have to be written as if they were under the root folder. |
I see, this sounds similar to #34371 (comment) and the shared snippet should allow rewriting correctly with |
Seems similar to the idea to make the |
Is there any update on this feature? Currently it is impossible to host more than one Next App on one domain as the webpack-hmr (WebPack Hot Module Replacement) calls will always hit '/_next/data' which will conflict with other apps hosted on the same domain. The 'assetPrefix' is not a solution as it only changes the assets, not the post-load webpack-hmr ajax calls (they still hit /_next). The basepath is also not a solution as it limits to a specific path. Without this feature NextJS is not suitable for enterprise solutions, just for small microsites. Any idea when this feature will be available? |
Setting a |
@hmacafee Your mileage may vary, but I got something working: #45422 (comment) I'm building two projects to static and serving both. |
This comment has been minimized.
This comment has been minimized.
I also need this feature. Some static site hosting services ignore any directories with an underscore in the name. On GH pages you can bypass this by simply adding a Astro provides this functionality in its config. thanks for considering |
Hello, |
What version of Next.js are you using?
12.0.4
What version of Node.js are you using?
12.22.7 / 14.17.5
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Local & Docker container
Describe the Bug
The following no longer works in Next.js 12 in combination with i18n
Requests for static assets return a 404.
Originally posted by @timneutkens in #5602 (comment)
Expected Behavior
changes default _next in request path into something custom
To Reproduce
$ yarn create next-app --typescript
next.config.js
$ yarn build
$ yarn start
Go to http://localhost:3000/, static assets are not loaded
The text was updated successfully, but these errors were encountered: