Skip to content

Instantly share code, notes, and snippets.

View xfournet's full-sized avatar

Xavier Fournet xfournet

  • YOOI
  • Lyon, France
View GitHub Profile
@xfournet
xfournet / pluginHttp2Proxy.ts
Last active May 7, 2024 13:51
Vite support for HTTP2 and proxy
import proxy from 'http2-proxy';
import type { Plugin, ProxyOptions } from 'vite';
export const pluginHttp2Proxy = (): Plugin => {
let routes: Record<string, string | ProxyOptions>;
return {
name: 'vite-plugin-http2-proxy',
config: (config) => {
const { server } = config;
routes = server?.proxy ?? {};