feat: add vite_allowed_hosts config option for Vite dev server#6147
feat: add vite_allowed_hosts config option for Vite dev server#6147milochen0418 wants to merge 1 commit intoreflex-dev:mainfrom
Conversation
Add a configurable `vite_allowed_hosts` field to `rx.Config` that controls whether `allowedHosts: true` is set in the Vite dev server configuration. This allows users running Reflex in Docker, Codespaces, or behind a reverse proxy to opt-in to allowing all hosts, preventing 403 Forbidden errors from Vite's host header validation. Default is `False` (original behavior, Vite only allows localhost). Users can enable it in rxconfig.py: config = rx.Config(app_name="myapp", vite_allowed_hosts=True) Or via environment variable: REFLEX_VITE_ALLOWED_HOSTS=true reflex run
Merging this PR will degrade performance by 3.03%
Performance Changes
Comparing |
Greptile SummaryThis PR adds a new Key changes:
Implementation quality: Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 5170c6f |
The 3.03% regression in test_compile_stateful (5µs difference) is within measurement noise and unrelated to this change — we only added a default False parameter and a conditional string line. |
Add a configurable
vite_allowed_hostsfield torx.Configthat controls whetherallowedHosts: trueis set in the Vite dev server configuration.This allows users running Reflex in Docker, Codespaces, or behind a reverse proxy to opt-in to allowing all hosts, preventing 403 Forbidden errors from Vite's host header validation.
Default is
False(original behavior, Vite only allows localhost). Users can enable it in rxconfig.py:config = rx.Config(app_name="myapp", vite_allowed_hosts=True)
Or via environment variable:
REFLEX_VITE_ALLOWED_HOSTS=true reflex run
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
After these steps, you're ready to open a pull request.