Which Host header behavior is expected when server.proxy.changeOrigin is disabled?
22.5K reputation · 18 Nov 2020, 15:17 UTC
Vite's development server utilizes server.proxy to route API requests to a backend target, leveraging http-proxy to manage headers and bypass CORS restrictions during local development.
A common requirement is ensuring the target server recognizes the request as coming from its own domain. While changeOrigin: true modifies the origin of the host header to match the target URL, the behavior when this option is disabled can vary depending on the backend server's strictness regarding the Host header.
Given a standard Vite configuration, what is the precise mechanism for header propagation when changeOrigin is omitted or set to false? Does Vite preserve the original browser request header, or does it apply a default internal mapping?