diff --git a/fe/README.md b/fe/README.md index 1d9f0d8..cc1a153 100644 --- a/fe/README.md +++ b/fe/README.md @@ -12,6 +12,14 @@ yarn yarn dev ``` +开发代理默认连接本机 HTTPS 后端 `https://127.0.0.1:443`。如果后端使用其他地址,请在 `fe/.env.development` 中设置: + +```env +VITE_DEV_BACKEND_URL=https://127.0.0.1:443 +``` + +自签名证书仅用于本地开发,代理不会校验证书链;生产环境应使用有效证书。 + ### Compile and Minify for Production ```sh diff --git a/fe/src/stores/useGlobalStatusStore.js b/fe/src/stores/useGlobalStatusStore.js index 5ed10ed..5766239 100644 --- a/fe/src/stores/useGlobalStatusStore.js +++ b/fe/src/stores/useGlobalStatusStore.js @@ -91,6 +91,7 @@ const useGlobalStatusStore = defineStore("useGlobalStatusStore", { this.authChecked = true; this.authStatus = AUTH_STATUS.UNAUTHENTICATED; this.authError = ""; + this.clearAuthRetryPath(); }, setUser(payload, resetPrompt = false) { const previousAccount = this.userInfos?.account || ""; @@ -114,11 +115,13 @@ const useGlobalStatusStore = defineStore("useGlobalStatusStore", { this.authChecked = true; this.authStatus = AUTH_STATUS.NEEDS_SETUP; this.authError = ""; + this.clearAuthRetryPath(); }, resetAuthAvailability() { this.authChecked = false; this.authStatus = AUTH_STATUS.UNKNOWN; this.authError = ""; + this.clearAuthRetryPath(); }, setAuthRetryPath(path) { this.authRetryPath = typeof path === "string" && path ? path : "/"; diff --git a/fe/vite.config.js b/fe/vite.config.js index 8214121..81bc3a9 100644 --- a/fe/vite.config.js +++ b/fe/vite.config.js @@ -9,7 +9,7 @@ import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), '') - const backendUrl = (env.VITE_DEV_BACKEND_URL || 'http://127.0.0.1:9001').replace(/\/$/, '') + const backendUrl = (env.VITE_DEV_BACKEND_URL || 'https://127.0.0.1:443').replace(/\/$/, '') return { plugins: [