Skip to content

fix: bypass subdomain validation when agents_url is configured for self-hosted deployments#803

Open
j0nscalet wants to merge 1 commit intolivekit:mainfrom
j0nscalet:fix/agents-url-self-hosted
Open

fix: bypass subdomain validation when agents_url is configured for self-hosted deployments#803
j0nscalet wants to merge 1 commit intolivekit:mainfrom
j0nscalet:fix/agents-url-self-hosted

Conversation

@j0nscalet
Copy link
Copy Markdown

@j0nscalet j0nscalet commented Mar 27, 2026

Problem

When LK_AGENTS_URL is set, subdomain validation should be skipped — but lk agent deploy always runs it first, making the override ineffective:

// cmd/lk/agent.go:371-372
if projectSubdomainMatch[1] != lkConfig.Project.Subdomain {
    return ctx, fmt.Errorf("project does not match agent subdomain [%s]", lkConfig.Project.Subdomain)
}
// LK_AGENTS_URL never reached

Fix

Add agents_url to LiveKitTOMLAgentConfig. When set, skip subdomain validation in the deploy path and apply it as LK_AGENTS_URL before cloudagents.New() is called.

[agent]
id = "my-agent-id"
agents_url = "https://agents.example.com"

Relates to #758.

Self-hosted deployments with custom domains (e.g. livekit.example.com)
cannot use lk agent commands because the subdomain extracted from the
project URL never matches the livekit.toml subdomain field.

Add agents_url to LiveKitTOMLAgentConfig and skip subdomain validation
when it is explicitly set, applying it as LK_AGENTS_URL instead.
@j0nscalet j0nscalet marked this pull request as ready for review March 28, 2026 00:12
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.

1 participant