From 5b6b2f052868ea26a166451efb5434fd6573a40f Mon Sep 17 00:00:00 2001 From: Athurg Gooth Date: Thu, 28 Sep 2023 18:45:45 +0800 Subject: [PATCH] fix: apiv2 failed in container (#2307) --- web/src/grpcweb.ts | 4 +--- web/vite.config.ts | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index 9e920677..347782fb 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -5,10 +5,8 @@ import { SystemServiceDefinition } from "./types/proto/api/v2/system_service"; import { TagServiceDefinition } from "./types/proto/api/v2/tag_service"; import { UserServiceDefinition } from "./types/proto/api/v2/user_service"; -const address = import.meta.env.MODE === "development" ? "http://localhost:8081" : window.location.origin; - const channel = createChannel( - address, + window.location.origin, FetchTransport({ credentials: "include", }) diff --git a/web/vite.config.ts b/web/vite.config.ts index d92719d9..791a1f93 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -19,6 +19,10 @@ export default defineConfig({ target: devProxyServer, xfwd: true, }, + "^/memos.api.v2": { + target: devProxyServer, + xfwd: true, + }, "^/o/": { target: devProxyServer, xfwd: true,