17 lines
495 B
TypeScript
17 lines
495 B
TypeScript
import type { ProxyOptions } from "vite";
|
|
|
|
/** Preserve the public origin used by FastAPI to construct the speech WebSocket URL. */
|
|
export function createBackendProxy(target: string): Record<string, ProxyOptions> {
|
|
const http: ProxyOptions = { target, changeOrigin: false };
|
|
return {
|
|
"/api": http,
|
|
"/v1/realtime": { ...http, ws: true },
|
|
"/docs": http,
|
|
"/redoc": http,
|
|
"/openapi.json": http,
|
|
"/oauth": http,
|
|
"/project": http,
|
|
"/public/docs.html": http,
|
|
};
|
|
}
|