proxy routing issue'
This commit is contained in:
parent
0d42ff72d3
commit
d077292bbc
9 changed files with 42 additions and 17 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
const proxyTarget = process.env.VITE_PROXY_TARGET ?? 'http://localhost:8000'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
|
|
@ -8,5 +10,12 @@ export default defineConfig({
|
|||
host: true,
|
||||
// Required when Caddy (or another proxy) forwards urmiai.com to the dev server
|
||||
allowedHosts: ['urmiai.com', 'www.urmiai.com', 'localhost'],
|
||||
// Same-origin API: browser calls urmiai.com/api/*, Vite forwards to backend
|
||||
proxy: {
|
||||
'/api': { target: proxyTarget, changeOrigin: true, ws: true },
|
||||
'/health': { target: proxyTarget, changeOrigin: true },
|
||||
'/docs': { target: proxyTarget, changeOrigin: true },
|
||||
'/openapi.json': { target: proxyTarget, changeOrigin: true },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue