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:
@@ -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?`,
|
||||
})
|
||||
)
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user