Vite-Proxy: direkt Appwrite, längere Timeouts gegen 504

Proxy-Ziel appwrite.webklar.com, 120s Timeout und 504-Hinweise in LOCAL_DEV.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Webklar Deploy
2026-05-22 18:56:25 +00:00
parent d2e7088146
commit f174421c63
3 changed files with 51 additions and 13 deletions

View File

@@ -3,18 +3,34 @@ import react from '@vitejs/plugin-react'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const apiTarget = env.VITE_APPWRITE_PROXY_TARGET || 'https://ticket.webklar.com'
// Direkt zu Appwrite (ein Hop weniger als ticket.webklar.com → nginx → Appwrite)
const apiTarget =
env.VITE_APPWRITE_PROXY_TARGET || 'https://appwrite.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,
timeout: 120_000,
proxyTimeout: 120_000,
cookieDomainRewrite: 'localhost',
configure: (proxy) => {
proxy.on('error', (err, req, res) => {
console.error('[vite proxy /v1]', err.message)
if (res && !res.headersSent) {
res.writeHead(502, { 'Content-Type': 'application/json' })
res.end(
JSON.stringify({
message: `Proxy-Fehler: ${err.message}. Ist ${apiTarget} erreichbar?`,
})
)
}
})
},
},
},
},