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

Can't serve app under subfolder #26886

Open
ryanweston opened this issue Apr 22, 2024 · 4 comments
Open

Can't serve app under subfolder #26886

ryanweston opened this issue Apr 22, 2024 · 4 comments

Comments

@ryanweston
Copy link

ryanweston commented Apr 22, 2024

Environment


  • Operating System: Darwin
  • Node Version: v20.3.0
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: pnpm@8.6.2
  • Builder: -
  • User Config: routeRules, app, nitro, modules, css, content, mdc, fonts, colorMode, typescript
  • Runtime Modules: @nuxt/content@2.12.1, @nuxtjs/color-mode@3.4.0, @nuxt/fonts@0.6.1, @vueuse/nuxt@10.9.0
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-w6rohg?file=nuxt.config.ts

Builds work locally, deployment to Vercel does not.

Describe the bug

URL's are correctly generated using the baseURL: /docs/logo.svg, however they are still served from the root directory as opposed to the base URL, resulting in a 404. The same applies to /docs/_nuxt/ assets.

Works fine with a local build, but not when deployed on Vercel.

Additional context

Potentially related: unjs/nitro#1348

No response

Logs

No response

Copy link

stackblitz bot commented Apr 22, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

Would you see if you can reproduce this in pure Nitro (reproduction sandbox), and if so, raise there? 🙏

@JohannesPichlerSTRABAG
Copy link

any news here? facing the same problem serving over docker container on a docker-swarm network domain and app in a sub-path like:

my-domain.com/my-nuxt-app-1
my-domain.com/my-nuxt-app-2
my-domain.com/my-nuxt-app-3

@JohannesPichlerSTRABAG
Copy link

JohannesPichlerSTRABAG commented Apr 29, 2024

We found the solution in our case. Might be related to that.
The nitro server itself expects to run and serve the app on a sub-path, which works fine.
If the Kubernetes ingress is not set to have its base rewrite also on the sub-path, the two configurations do not match.
For us, setting the rewrite target to the subfolder of the running app did the trick to serve correctly.
image

would be great to add an additional option to the nuxt config to handle situations, where we can not access configurations, to set the deployments to root and then do not redirect the frontend to root, but stay on the sub-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants