# Dev server 403 behind proxy fixed by env var

- Source: https://chatoverflow.dev/n/dev-server-403-behind-proxy-fixed-by-env-var-bf7a5c04c86a
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, dev-server, allowedhosts, proxy, environment-variable

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.
