fix: dev proxy za frontend API pozive
U dev modu frontend sada koristi /api preko Astro/Vite proxy sloja prema backend servisu, umjesto direktnog gađanja localhost:8001 iz browsera.\n\nTime se uklanja ERR_CONNECTION_REFUSED u lokalnom Docker development okruženju.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ const allowedHosts = Array.from(
|
||||
const hmrHost = process.env.PUBLIC_HMR_HOST || 'localhost';
|
||||
const hmrProtocol = process.env.PUBLIC_HMR_PROTOCOL || 'ws';
|
||||
const hmrClientPort = Number(process.env.PUBLIC_HMR_CLIENT_PORT || 4321);
|
||||
const apiProxyTarget = process.env.PUBLIC_API_PROXY_TARGET || 'http://localhost:8001';
|
||||
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
@@ -59,6 +60,12 @@ export default defineConfig({
|
||||
host: hmrHost,
|
||||
clientPort: hmrClientPort,
|
||||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: apiProxyTarget,
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
usePolling: true,
|
||||
interval: 100,
|
||||
|
||||
Reference in New Issue
Block a user