Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(site): set server.allowedHosts in storybook config to .coder #18598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jun 26, 2025

This lets you browse storybook using a Coder Desktop hostname (i.e. workspace.coder:6006). The default configuration (including localhost) will still work.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@@ -116,7 +116,7 @@ export default defineConfig({
secure: process.env.NODE_ENV === "production",
},
},
allowedHosts: true,
Copy link
Member Author

@ethanndickson ethanndickson Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to true opens developers up (as they run their dev server) to DNS rebinding attacks, as mentioned in the documentation:

    /**
     * The hostnames that Vite is allowed to respond to.
     * `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
     * When using HTTPS, this check is skipped.
     *
     * If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
     * For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
     *
     * If set to `true`, the server is allowed to respond to requests for any hosts.
     * This is not recommended as it will be vulnerable to DNS rebinding attacks.
     */
    allowedHosts?: string[] | true;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's any other domains you'd like to add, let me know.

@ethanndickson ethanndickson marked this pull request as ready for review June 26, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants