Skip to content

fix: compare providerHost against stripped protocol hostname in getWebsocketHost#1397

Merged
leecalcote merged 2 commits intomasterfrom
fix/release-workflow-dispatch
Apr 9, 2026
Merged

fix: compare providerHost against stripped protocol hostname in getWebsocketHost#1397
leecalcote merged 2 commits intomasterfrom
fix/release-workflow-dispatch

Conversation

@hortison
Copy link
Copy Markdown
Contributor

@hortison hortison commented Apr 9, 2026

Notes for Reviewers

This PR fixes #

Signed commits

  • Yes, I signed my commits.

…bsocketHost

Signed-off-by: Yi Nuo <218099172+yi-nuo426@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 9, 2026 10:34
@leecalcote leecalcote merged commit 54b2445 into master Apr 9, 2026
5 checks passed
@leecalcote leecalcote deleted the fix/release-workflow-dispatch branch April 9, 2026 10:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts getWebsocketHost to correctly detect the Meshery Cloud production provider host when the input host has been parsed from a URL (and therefore does not include the protocol).

Changes:

  • Derive the production host via new URL(MESHERY_CLOUD_PROD).host and compare providerHost against that value.
  • Add an explanatory comment about protocol stripping during URL parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +66 to 72
// Compare against hostnames without protocol since parsedUrl.host
// strips the protocol (e.g. "cloud.layer5.io" not "https://cloud.layer5.io")
const prodHost = new URL(MESHERY_CLOUD_PROD).host;
if (providerHost === prodHost) {
return MESHERY_CLOUD_WS_PROD;
} else if (providerHost === MESHERY_CLOUD_STAGING) {
return MESHERY_CLOUD_WS_STAGING;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

providerHost is passed as parsedUrl.host, which includes any explicit port (e.g. cloud.layer5.io:443). new URL(MESHERY_CLOUD_PROD).host will be cloud.layer5.io (no port), so this comparison will fail if the provider URL includes a port. Consider normalizing both sides using .hostname (or otherwise stripping any port / lowercasing) and doing the same normalization for staging for consistency.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants