summaryrefslogtreecommitdiff
path: root/microservices/04-react-app/vite.config.js
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-07-03 19:02:36 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-07-03 19:02:36 +0530
commitaa122113ade36f02dc8fdbebdf1232b5c4b8742c (patch)
treec345b83db6c769bf5e72a09e3f19d43431961695 /microservices/04-react-app/vite.config.js
parentb221a83ecef1dd7f9583d5107017d24e668205a6 (diff)
Microservice sample projects
Diffstat (limited to 'microservices/04-react-app/vite.config.js')
-rw-r--r--microservices/04-react-app/vite.config.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/microservices/04-react-app/vite.config.js b/microservices/04-react-app/vite.config.js
new file mode 100644
index 0000000..fb81936
--- /dev/null
+++ b/microservices/04-react-app/vite.config.js
@@ -0,0 +1,23 @@
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+
+// https://vite.dev/config/
+export default defineConfig({
+ plugins: [react()],
+
+ // Forward requests to /bff/api to another server (like json-server)
+ server: {
+ proxy: {
+ '/bff': {
+ target: 'http://localhost:8050',
+
+ changeOrigin: true, // Rewrites the host header to match the target
+
+ secure: false, // Allows self-signed SSL certificates for HTTPS targets
+
+ // Strips out '/bff' before passing the request to the target server
+ rewrite: (path) => path.replace(/^\/bff/, ''),
+ }
+ }
+ }
+})