Skip to content

Commit

Permalink
chore: refactor proxy configuration to use headers object
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Sep 16, 2024
1 parent 66c930c commit cd206ce
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const proxyURL = process.env.SERVER_URL
? process.env.SERVER_URL
: `${proxyScheme}://${proxyHostname}:${proxyPort}`

const headers = ingressToken
? {
headers: { cookie: `ingress_session=${ingressToken}` },
}
: {}

// const proxyWebSocketScheme = process.env.SERVER_SSL ? 'wss' : 'ws'
// const proxyWebSocketURL = `${proxyWebSocketScheme}://${proxyHostname}:${proxyPort}`

Expand Down Expand Up @@ -113,25 +119,19 @@ export default defineConfig(({ mode }) => {
ws: true,
secure: false, // allow self signed certificates
changeOrigin: true,
...(ingressToken && {
headers: { cookie: `ingress_session=${ingressToken}` },
}),
...headers,
},
'/health': {
target: proxyURL,
secure: false,
changeOrigin: true,
...(ingressToken && {
headers: { cookie: `ingress_session=${ingressToken}` },
}),
...headers,
},
'/api': {
target: proxyURL,
secure: false,
changeOrigin: true,
...(ingressToken && {
headers: { cookie: `ingress_session=${ingressToken}` },
}),
...headers,
},
},
},
Expand Down

0 comments on commit cd206ce

Please sign in to comment.