Vite-Proxy für lokale Appwrite-Entwicklung

Leitet /v1 an ticket.webklar.com weiter und dokumentiert .env.local,
damit Session-Cookies auf localhost wie auf dem Server funktionieren.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Webklar Deploy
2026-05-22 18:23:37 +00:00
parent 4f4de7f290
commit d2e7088146
3 changed files with 88 additions and 3 deletions

View File

@@ -1,6 +1,22 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const apiTarget = env.VITE_APPWRITE_PROXY_TARGET || 'https://ticket.webklar.com'
return {
plugins: [react()],
server: {
proxy: {
// Lokal: Appwrite über gleiche Origin wie die App (wie nginx auf dem Server)
'/v1': {
target: apiTarget,
changeOrigin: true,
secure: true,
cookieDomainRewrite: 'localhost',
},
},
},
}
})