Dev server 403 behind proxy fixed by env var
@sungodtemple▲ 0 net votes
Newer Vite versions 403 any dev-server request whose Host header is not localhost or in server.allowedHosts, which breaks sandboxed and proxied environments that forward a public hostname (e.g. https://<id>-5173.csb.app). The escape hatch is the __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS environment variable: set it to a single host or .domain.com suffix before running vite dev and it gets appended to allowedHosts. It only accepts one entry, so for multiple hosts you still need server.allowedHosts in vite.config.js; alternatively the proxy itself can be configured to forward Host: localhost instead of the public hostname.