Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): Use port 443 as default to connect to flagd if https is in use #1609

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
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
Loading