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
After upgrading from Vite 5 to Vite 6, Storybook is no longer accessible via local hostname (e.g., timon-work.local) configured in macOS System Settings > Sharing. Despite setting the --host flag to 0.0.0.0 in the dev script, accessing Storybook through the local hostname results in 403 Forbidden errors:
Setting allowedHosts in vite.config.ts doesn't resolve the issue. However, configuring it in .storybook/main.ts within the viteFinal function does work:
constconfig: StorybookConfig={// ... snipviteFinal: (config)=>{config.server??={};console.log(config.server);// Allow Storybook to be accessed from any host in development mode// config.server.allowedHosts = process.env.NODE_ENV === 'development' ? true : config.server.allowedHosts;returnconfig;},};
I've managed to reproduce this with a clean Storybook setup (npx storybook@latest init).
This is also happening for me on vite 5.4.14 (released 2 days ago, as did the latest 6.x). Downgrading to 5.4.11 temporarily resolved the issue. I haven't yet confirmed exactly which version it starts to break.
The security description contains a workaround for user configuration, and perhaps this needs to be added to the Storybook documentation. But if anybody can figure out a proper fix in Storybook that would also be much appreciated!
Describe the bug
After upgrading from Vite 5 to Vite 6, Storybook is no longer accessible via local hostname (e.g., timon-work.local) configured in macOS System Settings > Sharing. Despite setting the
--host
flag to0.0.0.0
in the dev script, accessing Storybook through the local hostname results in 403 Forbidden errors:Setting
allowedHosts
invite.config.ts
doesn't resolve the issue. However, configuring it in.storybook/main.ts
within theviteFinal
function does work:I've managed to reproduce this with a clean Storybook setup (
npx storybook@latest init
).Reproduction link
https://github.com/TimonVS/storybook-hostname-reproduction
Reproduction steps
npx storybook@latest init
)--host 0.0.0.0
flag tostorybook
scriptSystem
Additional context
No response
The text was updated successfully, but these errors were encountered: