Skip to content

fix bug where projects with "localhost" in the URL are misrouted#882

Merged
andrewnitu merged 2 commits intomainfrom
andrewnitu/fix-localhost-bug
Apr 10, 2026
Merged

fix bug where projects with "localhost" in the URL are misrouted#882
andrewnitu merged 2 commits intomainfrom
andrewnitu/fix-localhost-bug

Conversation

@andrewnitu
Copy link
Copy Markdown
Contributor

@andrewnitu andrewnitu commented Apr 8, 2026

The localhost check in getAgentsURL (line 157) uses strings.Contains to detect local development URLs, but this also matches project subdomains that happen to contain "localhost" as a substring (e.g. air-localhost-ist1jyfs).
When this happens, the regex replacement that rewrites the project subdomain to agents.livekit.cloud is skipped entirely. Requests to /build and other agent endpoints end up hitting the *.livekit.cloud wildcard ingress on the core cluster instead of the agents service, and the cloud-controller catch-all returns "OK" — which fails to decode as a valid response.

@andrewnitu andrewnitu requested review from real-danm and yoonsio April 8, 2026 19:10
Comment thread pkg/cloudagents/client.go
}

func isLocalURL(rawURL string) bool {
u, err := url.Parse(rawURL)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you add some tests for this? make sure we can support the project names with 'localhost' and a few other formats?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor

@yoonsio yoonsio left a comment

Choose a reason for hiding this comment

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

Would appreciate it if you could provide some context.
Do we have support for localhost projects?

@andrewnitu
Copy link
Copy Markdown
Contributor Author

@yoonsio a customer has a project name with "localhost" in it and the builds totally fail for them. see https://live-kit.slack.com/archives/C08HHUXHAKA/p1775494175027349 for details

tbh i don't know why this localhost thing is here, my guess is if you're testing multiple services on your laptop? Trying to not regress that workflow.

@andrewnitu andrewnitu requested review from real-danm and yoonsio April 8, 2026 19:37
@andrewnitu andrewnitu changed the title fix localhost bug fix bug where projects with "localhost" in the URL are misrouted Apr 10, 2026
@andrewnitu andrewnitu merged commit 36135a7 into main Apr 10, 2026
9 checks passed
@andrewnitu andrewnitu deleted the andrewnitu/fix-localhost-bug branch April 10, 2026 16:19
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.

3 participants