Skip to content

Commit be82fbb

Browse files
author
Guillaume FORTAINE
committed
fix: add VITE_INSECURE_PROXY opt-in for cert issues
The backend server doesn't send the full certificate chain (only leaf cert), causing TLS verification to fail even with system CA installed. Added VITE_INSECURE_PROXY=true as opt-in workaround for devs with internal endpoints.
1 parent 1e4c337 commit be82fbb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ The Vite proxy automatically:
7575
- Injects the NSC_TMAS cookie into all proxied requests
7676
- Supports WebSocket connections for `/api/back/ws`
7777

78-
> **Note:** If you encounter TLS certificate errors with internal endpoints, run with:
78+
> **Note:** If you encounter TLS certificate errors with internal endpoints, add `VITE_INSECURE_PROXY=true`:
7979
> ```bash
80-
> NODE_OPTIONS='--use-system-ca' NSC_TMAS=your_cookie npm run start
80+
> VITE_INSECURE_PROXY=true NSC_TMAS=your_cookie npm run start
8181
> ```
8282
8383
## Start Contributing

vite.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ export default defineConfig(() => {
5353
}
5454
const backend = BACKEND_ENVS[BACKEND_ENV]
5555

56-
// TLS verification is enabled by default. If you encounter certificate errors with
57-
// internal endpoints, run Node with: NODE_OPTIONS='--use-system-ca' npm run start
56+
// TLS verification is enabled by default. To disable for internal endpoints with
57+
// self-signed certs, set VITE_INSECURE_PROXY=true (not recommended on untrusted networks)
58+
const insecureProxy = process.env.VITE_INSECURE_PROXY === 'true'
5859
const createProxyConfig = (target: string, ws = false): ProxyOptions => ({
5960
target,
6061
changeOrigin: true,
61-
secure: true,
62+
secure: !insecureProxy,
6263
ws,
6364
rewrite: (path: string) => path.replace(/^\/api\/(fhir|back|datamodel)/, ''),
6465
configure: (proxy, _options) => {

0 commit comments

Comments
 (0)