summaryrefslogtreecommitdiff
path: root/react/08-auth-with-context/vite.config.js
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-07-02 20:17:44 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-07-02 20:17:44 +0530
commitb221a83ecef1dd7f9583d5107017d24e668205a6 (patch)
treef519d4a08e6fde2d175b2a16b6d71e90890666d2 /react/08-auth-with-context/vite.config.js
parent48f6e61f90e5a8465a9cee8b501d990c89d79c33 (diff)
Added React global state + role based security sample app
Diffstat (limited to 'react/08-auth-with-context/vite.config.js')
-rw-r--r--react/08-auth-with-context/vite.config.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/react/08-auth-with-context/vite.config.js b/react/08-auth-with-context/vite.config.js
new file mode 100644
index 0000000..f0b256a
--- /dev/null
+++ b/react/08-auth-with-context/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/api': {
+ target: 'http://localhost:3000',
+
+ changeOrigin: true, // Rewrites the host header to match the target
+
+ secure: false, // Allows self-signed SSL certificates for HTTPS targets
+
+ // Strips out '/bff/api' before passing the request to the target server
+ rewrite: (path) => path.replace(/^\/bff\/api/, ''),
+ }
+ }
+ }
+})