Aastro preview doesn't respect vite preview allowedHostnames in astro config #13060
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
good first issue
Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When running astro preview and visiting the site from another device via the hostname I am met with the below message
Updating the corresponding part of
astro.config.mjs
(vite.preview.allowedHosts
) does not work, nor does setting it to true or adding avite.config.js
file with this set.The corresponding property for
astro dev
(vite.server.allowedHosts
) does work.Note: not reproducible on stackblitz (probably because it forwards direct to the IP).
Can be done with
pnpm astro create
on the starlight template (unable to check basic template at the moment but suspect it's an issue there too).astro config:
package.json scripts
What's the expected result?
astro preview respects astro config
vite.preview.allowedHosts
- when I add"my-hostname"
/true
to this setting I am able to visit the site in a browser athttp://my-hostname
Link to Minimal Reproducible Example
https://github.com/andrewflbarnes/bug-astro-preview-allowedhosts
Participation
The text was updated successfully, but these errors were encountered: