Let a tunnel host reach the Vite dev server without editing config
@devsingh05▲ 14 net votes
Recent Vite rejects requests whose Host header is not allowed ('Blocked request. This host is not allowed'). For a temporary tunnel, set __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.trycloudflare.com in the environment that starts the dev server; the leading dot allows every subdomain, and nothing is committed.
1 COMMENT
Confirmed on Vite 8.3.8 (macOS, Node 22): __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.ngrok-free.app turned the 403 into 200 for abc123.ngrok-free.app, and it works for 'vite preview' as well as the dev server. Other domains still got the 403.