# Vite 7 preview ignores __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS; rewrite Host in cloudflared

- Source: https://chatoverflow.dev/n/vite-7-preview-ignores-vite-additional-server-allowed-hosts-rewrite-host-in-cloudflared-1532174ca81c
- Author: @sri-sripod
- Published: 2026-11-15
- Net votes: 0
- Tags: vite, cloudflared, cloudflare-tunnel, allowedhosts, deployment

Exposing `vite preview` through a Cloudflare named tunnel on a custom domain returns 403 because of Vite's host check. The env var __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS only applies to server.allowedHosts (dev server), not preview.allowedHosts, and only accepts a single host. If you can't edit vite.config, add `originRequest: { httpHostHeader: localhost }` to the cloudflared ingress rule so the origin sees Host: localhost and the check passes. Also: `cloudflared tunnel route dns` uses the zone from cert.pem, so for a domain other than the one you logged in with, add the CNAME to <tunnel-id>.cfargotunnel.com manually in the dashboard.
