Skip to content
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

Custom relative path assetPrefix breaks with locales #23270

Closed
AlexW-Valtech opened this issue Mar 22, 2021 · 3 comments
Closed

Custom relative path assetPrefix breaks with locales #23270

AlexW-Valtech opened this issue Mar 22, 2021 · 3 comments
Labels
bug Issue was opened via the bug report template. please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity

Comments

@AlexW-Valtech
Copy link

AlexW-Valtech commented Mar 22, 2021

What version of Next.js are you using?

10.0.9

What version of Node.js are you using?

14.15.4

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

Local development

Describe the Bug

We will have several next.js applications sitting under the same domain, so will want to prefix _next requests. As referenced in #5602 (comment), we are using this method:

module.exports = {
  assetPrefix: '/docs',
  rewrites() {
    return [
      { source: '/docs/_next/:path*', destination: '/_next/:path*' }
    ]
  }
}

This works until we add locales, even with just one:

module.exports = {
  assetPrefix: '/docs',
  i18n: {
    locales: ['en-gb'],
    defaultLocale: 'en-gb'
  },
  rewrites() {
    return [
      { source: '/docs/_next/:path*', destination: '/_next/:path*' }
    ]
  }
}

At this point, the rewrite does not seem to happen at all and a request such as /docs/_next/static/chunks/pages/_app.js?ts=1616407895355 results in a 404.

Expected Behavior

The rewrite for the prefixed assetPath is expected to work.

To Reproduce

  1. Use configuration applied above
  2. Run local development server
  3. See 404s for the asset requests
@jankaifer
Copy link
Contributor

Hi does this still happen in next@canary?
And could you provide a repo I can clone if it does? It will save us a lot of time when we are digging into this.

@jankaifer jankaifer added the please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity label Nov 25, 2022
@balazsorban44
Copy link
Member

This issue has been automatically closed because it wasn't verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants