A Vite plugin that enables HTTP/2 proxy support for development servers. Current stable version v0.5.1 supports Vite 2 through 7 with TypeScript types. It wraps the underlying http-proxy and provides HTTP/2 connectivity, which is not natively supported by Vite's built-in proxy. Unlike Vite's default http-proxy configuration, this plugin handles the `http2` session negotiation transparently. Released occasionally with focus on compatibility across major Vite versions.
npm install vite-plugin-http2-proxyVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in vite.config.ts to proxy /api requests to an HTTP/2 backend with changeOrigin enabled.
Use dynamic import or switch project to ESM.
Avoid reusing the same path key in both Vite's `server.proxy` and this plugin.
Verify your backend server is configured for HTTP/2 (e.g., h2 or h2c).
Remove `session` from proxy configuration; it is now handled internally.
Run `npm install vite-plugin-http2-proxy --save-dev` and ensure import path is correct.
Use `import` or switch to dynamic import: `const plugin = await import('vite-plugin-http2-proxy')`.Pass a configuration object to the plugin function, e.g., `vitePluginHttp2Proxy({ '/api': { target: '...' } })`.Ensure your target server is up and accepting connections on the specified port.