diff --git a/decnet/env.py b/decnet/env.py index d1cf68f..fa0c0fb 100644 --- a/decnet/env.py +++ b/decnet/env.py @@ -57,5 +57,5 @@ DECNET_DEVELOPER: bool = os.environ.get("DECNET_DEVELOPER", "False").lower() == # CORS — comma-separated list of allowed origins for the web dashboard API. # Example: DECNET_CORS_ORIGINS=http://localhost:8080,https://dashboard.example.com -_cors_raw: str = os.environ.get("DECNET_CORS_ORIGINS", "http://localhost:8080") +_cors_raw: str = os.environ.get("DECNET_CORS_ORIGINS", "http://localhost:8080,http://localhost:5173") DECNET_CORS_ORIGINS: list[str] = [o.strip() for o in _cors_raw.split(",") if o.strip()] diff --git a/decnet_web/src/utils/api.ts b/decnet_web/src/utils/api.ts index 315653a..8b78ef1 100644 --- a/decnet_web/src/utils/api.ts +++ b/decnet_web/src/utils/api.ts @@ -1,7 +1,7 @@ import axios from 'axios'; const api = axios.create({ - baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8000/api/v1', + baseURL: import.meta.env.VITE_API_URL || '/api/v1', }); api.interceptors.request.use((config) => { diff --git a/decnet_web/vite.config.ts b/decnet_web/vite.config.ts index 8b0f57b..12f020c 100644 --- a/decnet_web/vite.config.ts +++ b/decnet_web/vite.config.ts @@ -4,4 +4,12 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + proxy: { + '/api': { + target: 'http://localhost:8000', + changeOrigin: true, + }, + }, + }, })