A Vite plugin that resolves the conflict between using HTTP/2 (h2) and Vite's built-in proxy. When HTTPS is enabled for HTTP/2, Vite's proxy configuration becomes incompatible. This plugin provides a separate proxy table configuration via a file path or object, enabling both HTTP/2 and proxy to work simultaneously. v1.0.2 is stable. Requires Vite with HTTPS enabled. Alternative to manually working around the conflict.
npm install vite-plugin-proxy-middlewareVerified import paths — ran on the pinned version, not inferred.
Shows basic configuration with proxy table object, HTTPS setup for HTTP/2, and note to avoid Vite's native proxy option.
Remove server.proxy from vite.config; use plugin's proxyTable instead.
Generate SSL certificates and set server.https in vite.config.
Ensure proxy-table.js/ts exports an object like { dev: { ... }, prod: { ... } }.Include rewrite in proxy rule: { target: '...', rewrite: (path) => path.replace(/^\/api/, '') }Add proxyTable: { ... } or proxyTable: './path/to/proxy-table' to VitePluginProxyMiddleware options.Ensure the proxy table file exists at the specified path and exports an object.