fix(examples): allow trycloudflare.com in Vite allowedHosts#8750
Merged
Conversation
Vite 6 rejects tunnel Host headers with 403; allow *.trycloudflare.com for dev and preview so examples work over HTTPS tunnels (e.g. AVP testing).
mvaligursky
added a commit
that referenced
this pull request
May 20, 2026
Adds optional HTTPS dev server for testing the examples browser on phones, tablets, and XR headsets over LAN. The default `npm run develop` flow is unchanged. - New `develop:https` script — HTTPS variant of `develop`, reads certs from `examples/.cert/`. Fails fast if certs are missing. - New `cert` script — generates local dev certs via mkcert for localhost, 127.0.0.1, ::1, and the machine's .local hostname. Extra SANs accepted as positional args: `npm run cert -- 10.0.0.42`. - Vite `allowedHosts` switched from `.trycloudflare.com` (corp-blocked, #8750) to `['localhost', '.local']` for LAN device testing under Vite 6's host check. - `examples/.cert/` added to .gitignore. - README gains an "HTTPS dev for mobile / XR device testing" section with mkcert setup, per-device trust steps, dynamic LAN IPs, and troubleshooting. Verified on Mac, Android, and Apple Vision Pro. Quest 3 path is documented but not verified (requires Meta Developer Mode). Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow the examples Vite dev and preview servers to accept requests when accessed through a Cloudflare quick tunnel (
*.trycloudflare.com).Changes:
server.allowedHostsandpreview.allowedHoststo['.trycloudflare.com']inexamples/vite.config.mjsWithout this, Vite 6 returns 403 on assets such as
/@vite/clientwhen the browser sends the tunnel hostname in theHostheader (common for HTTPS headset / AVP testing viacloudflared).Test plan
npm run devinexamples/, tunnel withcloudflared tunnel --url http://localhost:5555, open tunnel URL — examples shell loads without 403 on Vite assetsnpm run build && npm run serve, same tunnel — preview works on tunnel URLhttp://localhost:5555still works unchanged