Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
feat: frontend uses relative API path (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylarmb authored Sep 19, 2024
1 parent d18fb50 commit 65ce046
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 3 additions & 5 deletions kontrol-frontend/.env.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# default: use local kontrol API
VITE_API_URL=http://localhost:8080

# uncomment to use production kontrol API proxy locally
# VITE_API_URL=http://localhost:5173/api
# default: use local kontrol API.
# To use production API, change the proxy target in vite.config.ts
VITE_API_URL=/api
2 changes: 1 addition & 1 deletion kontrol-frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_URL=https://app.kardinal.dev/api
VITE_API_URL=/api
7 changes: 6 additions & 1 deletion kontrol-frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ export default defineConfig(({ mode }) => {
},
server: {
proxy: {
// local dev mode proxy, default is local kontrol service.
// change this to hit production etc if desired.
// in production, this behavior is handled by kardinal nginx ingress
"/api": {
target: "https://app.kardinal.dev",
// target: "https://app.kardinal.dev",
target: "http://localhost:8080",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
Expand Down

0 comments on commit 65ce046

Please sign in to comment.