Skip to content

Commit

Permalink
fix(frontend): Use port 443 as default to connect to flagd if https i…
Browse files Browse the repository at this point in the history
…s in use
  • Loading branch information
SvenKirschbaum committed Jun 17, 2024
1 parent 6fd371c commit 1a28f00
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ if (typeof window !== 'undefined') {
* We connect to flagd through the envoy proxy, straight from the browser,
* for this we need to know the current hostname and port.
*/

const useTLS = window.location.protocol === 'https:';
let port = useTLS ? 443 : 80;
if (window.location.port) {
port = parseInt(window.location.port, 10);
}

OpenFeature.setProvider(
new FlagdWebProvider({
host: window.location.hostname,
pathPrefix: 'flagservice',
port: window.location.port ? parseInt(window.location.port, 10) : 80,
tls: window.location.protocol === 'https:',
port: port,
tls: useTLS,
maxRetries: 3,
maxDelay: 10000,
})
Expand Down

0 comments on commit 1a28f00

Please sign in to comment.