Skip to content

Docs: Add allowedHosts core config option #33987

Merged
ghengeveld merged 2 commits into
nextfrom
origin-validation-docs
Mar 6, 2026
Merged

Docs: Add allowedHosts core config option #33987
ghengeveld merged 2 commits into
nextfrom
origin-validation-docs

Conversation

@ghengeveld
Copy link
Copy Markdown
Member

@ghengeveld ghengeveld commented Mar 3, 2026

What I did

Added configuration snippet and documentation for allowedHosts in Storybook core settings. See #33835

Summary by CodeRabbit

Documentation

  • Added comprehensive documentation and configuration examples for the allowed hosts feature, enabling developers to configure which hosts can access the development server. Includes examples spanning React, Vue, Angular, and web-components frameworks, with both standard and typed configuration methods, plus various modern CSF setup patterns.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Adds documentation and multiple example snippets for a new main config property core.allowedHosts (type string[] | true), and documents its purpose, default, and usage in the API reference.

Changes

Cohort / File(s) Summary
allowedHosts doc + snippets
docs/_snippets/main-config-core-allowed-hosts.md, docs/api/main-config/main-config-core.mdx
Adds `core.allowedHosts?: string[]

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #33835: Implements allowedHosts handling and origin validation in the dev server used by this documentation.

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghengeveld ghengeveld added the ci:docs Run the CI jobs for documentation checks only. label Mar 3, 2026
- Add CSF Next examples to snippet
- Prose improvements
Copy link
Copy Markdown
Contributor

@kylegach kylegach left a comment

Choose a reason for hiding this comment

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

Thanks for handling this!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
docs/_snippets/main-config-core-allowed-hosts.md (1)

27-53: Minor inconsistency in property ordering between React snippets.

The React TypeScript CSF Next snippet (lines 31-37) has stories before framework, while the React JavaScript CSF Next snippet (lines 46-52) has framework before stories. For consistency with the other snippets and maintainability, consider aligning the property order.

Suggested fix for property order consistency
 export default defineMain({
-  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
   framework: '@storybook/your-framework',
+  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
   core: {
     allowedHosts: ['storybook.example.local'],
   },
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/_snippets/main-config-core-allowed-hosts.md` around lines 27 - 53, The
two CSF Next snippets export the same defineMain configuration but have
inconsistent property order: in the object passed to defineMain the TypeScript
snippet lists stories before framework while the JavaScript snippet lists
framework before stories; update the JavaScript snippet so the exported object
uses the same ordering as the TypeScript one (put stories before framework) in
the default export passed to defineMain to maintain consistency across examples.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/_snippets/main-config-core-allowed-hosts.md`:
- Around line 27-53: The two CSF Next snippets export the same defineMain
configuration but have inconsistent property order: in the object passed to
defineMain the TypeScript snippet lists stories before framework while the
JavaScript snippet lists framework before stories; update the JavaScript snippet
so the exported object uses the same ordering as the TypeScript one (put stories
before framework) in the default export passed to defineMain to maintain
consistency across examples.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5e65ec and 506c0cd.

📒 Files selected for processing (2)
  • docs/_snippets/main-config-core-allowed-hosts.md
  • docs/api/main-config/main-config-core.mdx

@ghengeveld ghengeveld enabled auto-merge March 6, 2026 11:20
@ghengeveld ghengeveld added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Mar 6, 2026
@ghengeveld ghengeveld disabled auto-merge March 6, 2026 11:44
@ghengeveld ghengeveld merged commit e81fd16 into next Mar 6, 2026
18 of 21 checks passed
@ghengeveld ghengeveld deleted the origin-validation-docs branch March 6, 2026 11:44
ghengeveld added a commit that referenced this pull request Mar 6, 2026
Docs: Add `allowedHosts` core config option
(cherry picked from commit e81fd16)
@github-actions github-actions Bot mentioned this pull request Mar 6, 2026
11 tasks
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Mar 6, 2026
@github-actions github-actions Bot mentioned this pull request Mar 9, 2026
31 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:docs Run the CI jobs for documentation checks only. documentation patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants