From d63ad7512334da717176e53136b1fd6f746785d6 Mon Sep 17 00:00:00 2001 From: Sven Kirschbaum Date: Mon, 17 Jun 2024 22:52:54 +0200 Subject: [PATCH 1/2] fix(frontend): Use port 443 as default to connect to flagd if https is in use --- src/frontend/pages/_app.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/pages/_app.tsx b/src/frontend/pages/_app.tsx index 00a7e696b5..e49b51f7c6 100755 --- a/src/frontend/pages/_app.tsx +++ b/src/frontend/pages/_app.tsx @@ -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, }) From a5d285c804c94341308e4429dfbc46ef8417a7ce Mon Sep 17 00:00:00 2001 From: Sven Kirschbaum Date: Tue, 18 Jun 2024 20:25:48 +0200 Subject: [PATCH 2/2] chore: Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23c53b3f08..40a7b61d10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ the release. ([#1610](https://github.com/open-telemetry/opentelemetry-demo/pull/1610)) * [Valkey] Replace Redis with Valkey ([#1619](https://github.com/open-telemetry/opentelemetry-demo/pull/1619)) +* [frontend] fixed default flagd port for HTTPS connections + ([#1609](https://github.com/open-telemetry/opentelemetry-demo/pull/1609)) ## 1.10.0