You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Astro v5.1.9
Node v22.6.0
System Linux (x64)
Package Manager pnpm
Output static
Adapter none
Integrations @astrojs/starlight
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
Blocked request. This host ("my-hostname") is not allowed.
To allow this host, add "my-hostname" to `preview.allowedHosts` in vite.config.js.
Updating the corresponding part of astro.config.mjs (vite.preview.allowedHosts) does not work, nor does setting it to true or adding a vite.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 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 at http://my-hostname
Link to Minimal Reproducible Example
not reproducible on stackblitz - use astro create locally and add vite.preview.allowedHosts per description
Participation
I am willing to submit a pull request for this issue.
The text was updated successfully, but these errors were encountered:
Hello @andrewflbarnes. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.
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
not reproducible on stackblitz - use
astro create
locally and addvite.preview.allowedHosts
per descriptionParticipation
The text was updated successfully, but these errors were encountered: