feat(core): add allowedHosts to open-slide.config.ts - #336
feat(core): add allowedHosts to open-slide.config.ts#336ridemountainpig wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@ridemountainpig is attempting to deploy a commit to the open-slide Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds optional ChangesAllowed hosts configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant UserConfig
participant createViteConfig
participant ViteDevServer
UserConfig->>createViteConfig: allowedHosts
createViteConfig->>ViteDevServer: server.allowedHosts
ViteDevServer->>ViteDevServer: Allow configured host
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/allowed-hosts-config.md:
- Line 5: Update the changeset description in allowed-hosts-config.md to use
present-tense wording by changing “Add” to “Adds,” without altering the rest of
the description.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 842f2e0d-909c-487f-97b4-1abf19e1a849
📒 Files selected for processing (5)
.changeset/allowed-hosts-config.mdapps/web/content/docs/cli/dev.mdxapps/web/content/docs/reference/config.mdxpackages/core/src/config.tspackages/core/src/vite/config.ts
| "@open-slide/core": minor | ||
| --- | ||
|
|
||
| Add `allowedHosts` to `open-slide.config.ts` so proxied domains (Coder, Codespaces, reverse proxies) can reach the dev and preview servers. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use present tense in the changeset description.
Change “Add” to “Adds” to follow the repository’s changeset wording rule.
Proposed fix
-Add `allowedHosts` to `open-slide.config.ts` so proxied domains (Coder, Codespaces, reverse proxies) can reach the dev and preview servers.
+Adds `allowedHosts` to `open-slide.config.ts` so proxied domains (Coder, Codespaces, reverse proxies) can reach the dev and preview servers.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Add `allowedHosts` to `open-slide.config.ts` so proxied domains (Coder, Codespaces, reverse proxies) can reach the dev and preview servers. | |
| Adds `allowedHosts` to `open-slide.config.ts` so proxied domains (Coder, Codespaces, reverse proxies) can reach the dev and preview servers. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/allowed-hosts-config.md at line 5, Update the changeset
description in allowed-hosts-config.md to use present-tense wording by changing
“Add” to “Adds,” without altering the rest of the description.
Source: Coding guidelines
Closes #334
What
Adds
allowedHoststoopen-slide.config.ts, passed straight to Vite'sserver.allowedHosts:Remote IDEs (Coder, Codespaces, Gitpod, …) reach the dev server through a generated proxy domain, and Vite blocks those requests with
Blocked request. This host is not allowed.Since open-slide owns the Vite config, users had no way to allow their domain.Why a config field instead of the proposed CLI flag
The issue proposed
--allow-all-hosts. A config field covers the same need with two upsides: the workspace domain is a property of the environment, so it belongs in the config rather than on every invocation, andstring[]lets users allow just their own domain instead of disabling host checking entirely (truestill works for that). Happy to add the flag on top if you'd prefer both.No change when the field is unset — Vite's default protection stays as is.
open-slide previewpicks it up too, since Vite'spreview.allowedHostsdefaults toserver.allowedHosts.Docs updated: schema + a "Remote IDE / proxied dev server" recipe in the config reference, and a pointer from the
devCLI page.Testing
Verified end-to-end against the demo app (curl with a spoofed
Hostheader):allowedHosts: trueallowedHosts: ['.domain.tld']pnpm typecheck,pnpm check, andpnpm test(305 tests) all pass.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
allowedHostsconfiguration for development and preview servers.Documentation