#base url not working as expected during dev

2 messages · Page 1 of 1 (latest)

crude harness
#

https://github.com/withastro/astro/issues/11445

Describe the Bug

When setting the base url to /base
In dev:
The styles/scripts which are added by astro/vite themselves do not have the base prepended
eg. /@vite/client, all /@fs/, /node_modules/ etc.

What's the expected result?

All assets should have their urls prepended with base
eg. /base/@vite/client, /base/@fs/, /base/node_modules/ etc.

In a vite react project during dev. when the base is set:
All the scripts/styles injected contain that base path.
Example: https://stackblitz.com/edit/vitejs-vite-nmbndk

In prod the base url works as expected and is prepended to all assets.

This is important in the scenario where astro server is running behind a proxy and we need to forward all assets call to a server.

I didnt find any docs on what urls are used otherwise one hack would be to forward those reqs. but that could break in case we have two astro servers behind a proxy

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-5atatw

woeful fox