From 77f8485c479e993af6fca08aeb4833f6652b20d9 Mon Sep 17 00:00:00 2001 From: Darren Yu Date: Fri, 3 Apr 2026 09:16:40 +0800 Subject: [PATCH] feat: refactor backend proxy configuration --- vite.config.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 6853dd601..b10d82025 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,6 +7,7 @@ import { VitePWA } from "vite-plugin-pwa"; import { viteStaticCopy } from "vite-plugin-static-copy"; const backend = "http://localhost:5212"; +const backendProxyOption = { target: backend, headers: { host: new URL(backend).host } }; // https://vitejs.dev/config/ export default defineConfig({ @@ -102,10 +103,10 @@ export default defineConfig({ host: "0.0.0.0", cors: false, proxy: { - "/api": { target: backend }, - "/s/": { target: backend }, - "/f/": { target: backend }, - "/manifest.json": { target: backend }, + "/api": backendProxyOption, + "/s/": backendProxyOption, + "/f/": backendProxyOption, + "/manifest.json": backendProxyOption, }, }, });