Describe the bug
In Nuxt, you can specify the app.baseUrl config to run the app in a "subfolder". That does work well locally in dev mode and also when running via npm run build && nuxi start.
We run a reverse proxy to ONLY serve our app at domain.com/my-page/ (and everything else like domain.com is non-nuxt)
It does not work when deploying to hub.nuxt.com. It also does not work with vanilla cloudflare pages and it also does not work for netlify. So it's probably not a nuxt-hub only issue, but maybe there is a way how to configure this on nuxt-hub/cloudflare to make it work.
When adding a baseUrl like /my-page/ then website runs at domain.com/my-page. Nuxt also correctly requests all assets from there, e.g.
domain.com/my-page/_nuxt/abc123.js
domain.com/my-page/_nuxt/abc123.css
domain.com/my-page/my-images/logo.png
The problem is, that npm run build does not output _nuxt/ at that location but at the root. So you can actually open
domain.com/_nuxt/abc123.js --> status 200
domain.com/my-page/_nuxt/abc123.js --> status 404
We run a reverse proxy to ONLY serve our app at domain.com/my-page/, so you would never find the assets at the root. They should be correctly served from domain.com/my-page/_nuxt/abc123.js. Contents of dist should be found at domain.com/my-page/
Describe the bug In Nuxt, you can specify the app.baseUrl config to run the app in a "subfolder". That does work well locally in dev mode and also when running via
npm run build && nuxi start
.We run a reverse proxy to ONLY serve our app at
domain.com/my-page/
(and everything else like domain.com is non-nuxt)It does not work when deploying to hub.nuxt.com. It also does not work with vanilla cloudflare pages and it also does not work for netlify. So it's probably not a nuxt-hub only issue, but maybe there is a way how to configure this on nuxt-hub/cloudflare to make it work.
When adding a baseUrl like
/my-page/
then website runs atdomain.com/my-page
. Nuxt also correctly requests all assets from there, e.g.domain.com/my-page/_nuxt/abc123.js
domain.com/my-page/_nuxt/abc123.css
domain.com/my-page/my-images/logo.png
The problem is, that
npm run build
does not output_nuxt/
at that location but at the root. So you can actually opendomain.com/_nuxt/abc123.js
--> status 200domain.com/my-page/_nuxt/abc123.js
--> status 404We run a reverse proxy to ONLY serve our app at
domain.com/my-page/
, so you would never find the assets at the root. They should be correctly served fromdomain.com/my-page/_nuxt/abc123.js
. Contents ofdist
should be found atdomain.com/my-page/
There is an upstream issue here: https://github.com/unjs/nitro/issues/1484 But I am not sure if this is something need to be configured on Hub/Cloudflare side.
Steps to reproduce Steps to reproduce the behavior:
app.baseUrl
set to non-empty, like/my-page
Expected behavior
dist
should be found atdomain.com/my-page/