Fix Login: Session-Cookies via Vite-Proxy + credentials:include

- Vite-Proxy für /api/* zum Express-Backend (localhost:8080)
- credentials: 'include' in customFetch für Cross-Origin-Cookie-Support
- Behebt: Login-Response-Set-Cookie wurde vom Browser ignoriert
This commit is contained in:
root
2026-07-29 19:29:46 +02:00
parent 41de2c4c52
commit 4e0861df71
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -63,6 +63,12 @@ export default defineConfig({
strictPort: true,
host: "0.0.0.0",
allowedHosts: true,
proxy: {
"/api": {
target: process.env.API_SERVER_URL || "http://localhost:8080",
changeOrigin: true,
},
},
fs: {
strict: true,
},
+1 -1
View File
@@ -360,7 +360,7 @@ export async function customFetch<T = unknown>(
const requestInfo = { method, url: resolveUrl(input) };
const response = await fetch(input, { ...init, method, headers });
const response = await fetch(input, { ...init, method, headers, credentials: "include" });
if (!response.ok) {
const errorData = await parseErrorBody(response, method);