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

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
}),
);
}
config.server.allowedHosts = [".coder"];
return config;
},
};
2 changes: 1 addition & 1 deletion site/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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.

allowedHosts: [".coder"],
},
resolve: {
alias: {
Expand Down
Loading