Skip to content

fix(chaoscenter): fix backend url trailing slash issue #5393#5398

Open
SharanRP wants to merge 1 commit intolitmuschaos:masterfrom
SharanRP:fix/backend-url-trailing-slash-5393
Open

fix(chaoscenter): fix backend url trailing slash issue #5393#5398
SharanRP wants to merge 1 commit intolitmuschaos:masterfrom
SharanRP:fix/backend-url-trailing-slash-5393

Conversation

@SharanRP
Copy link
Contributor

Trims trailing slashes from CHAOS_CENTER_UI_ENDPOINT and host to prevent double slashes in the backend URL constructed for agents.

Proposed changes

This PR fixes an issue where the backend URL constructed for the litmus-agent would contain double slashes (e.g., https://host//api/query) if the configured CHAOS_CENTER_UI_ENDPOINT or the host variable contained a trailing slash.

Fix:

  • Updated the GetEndpoint function in infra_utils.go to trim trailing slashes from the base URL before appending /api/query.
  • This ensures the agent can successfully connect to the backend regardless of whether the input URL has a trailing slash or not.

Fixes #5393

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

N/A

Special notes for your reviewer:

Verified the fix locally by running unit tests against GetEndpoint with various URL patterns (with and without trailing slashes). The tests confirmed that the URL is now correctly normalized in all cases. The separate test file was not included in this PR to keep the changes minimal.

Trims trailing slashes from CHAOS_CENTER_UI_ENDPOINT and host to prevent double slashes in the backend URL constructed for agents.

Signed-off-by: SharanRP <z8903830@gmail.com>
@kabilesh13
Copy link

@SharanRP some checks are not successful

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.

Error with backend url causing issues in litmus agent deployment

2 participants