diff --git a/.env b/.env new file mode 100644 index 0000000..ad02ea4 --- /dev/null +++ b/.env @@ -0,0 +1,11 @@ +# Dev uses the Vite proxy (see vite.config.js), so these are SAME-ORIGIN relative paths. +# The proxy forwards them to the Spring Boot backend, so the browser never makes a +# cross-origin request and CORS is avoided entirely in development. +VITE_AUTH_SERVICE_URL=/auth-service +VITE_OPR_API_URL=/opr-rest-api +VITE_CRM_API_URL=/crm-rest-api + +# --- If you ever call the backend DIRECTLY (no proxy), use absolute URLs instead and +# --- configure CORS on the backend (allowCredentials=true + explicit origin, never "*"): +# VITE_AUTH_SERVICE_URL=http://localhost:8080/auth-service +# VITE_OPR_API_URL=http://localhost:8080/opr-service diff --git a/.gitignore b/.gitignore index 8d206f7..77d3ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ dist/ build/ # Env and logs -.env *.log # Editor and system files diff --git a/vite.config.js b/vite.config.js index 09722b3..aefd748 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,9 +1,9 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' -const AUTH_BACKEND = 'http://localhost:8080' // auth-service -const CRM_BACKEND = 'http://localhost:8082' // crm-rest-api -const OPR_BACKEND = 'http://localhost:8083' // opr-rest-api +const AUTH_BACKEND = 'http://auth-service:8080' // auth-service +const CRM_BACKEND = 'http://crm-rest-api:8082' // crm-rest-api +const OPR_BACKEND = 'http://opr-rest-api:8083' // opr-rest-api // https://vite.dev/config/ export default defineConfig({