Skip to content

[Bugfix][Router] Accept single-label static backend URLs - #1154

Open
spicysharkco wants to merge 1 commit into
vllm-project:mainfrom
spicysharkco:fix/validate-url-single-label
Open

spicysharkco wants to merge 1 commit into
vllm-project:mainfrom
spicysharkco:fix/validate-url-single-label

Conversation

@spicysharkco

Copy link
Copy Markdown

This carries #737 by @osaimi forward. #737's current head, with the update from @ruizhang0101, already has the hyphen guard the automated review asked for. Its first commit has no sign-off, so the DCO check there still fails. This PR adds the tests and a signed-off commit, and drops the localhost alternative that the single-label pattern already covers. Happy to close it if you prefer to update #737 instead.

With --static-backends http://oss-20b:8000, the router logs Skipping invalid URL: http://oss-20b:8000 and drops the backend. validate_url() accepts dotted domains, localhost, and IPv4, but no other single-label host (src/vllm_router/utils.py:173-175). The new pattern accepts service names with ports or paths, including underscores, and rejects a leading or trailing hyphen on single-label hosts. localhost still matches it. Multi-label hosts keep the current pattern, so every URL main accepts today is still accepted. IPv6 validation is outside this change.

Startup and dynamic configuration both go through parse_static_urls() (src/vllm_router/app.py:202, src/vllm_router/dynamic_config.py:178). YAML and Helm pass backend strings to it; service discovery adds no second URL-format check.

Run from the repository root with router and test dependencies installed:

PYTHONPATH=src python -m pytest src/tests/test_utils.py -k 'validate_url or parse_static_urls' -q
PYTHONPATH=src python -m pytest src/tests/test_utils.py src/tests/test_parser.py src/tests/test_static_service_discovery.py -q
pre-commit run --files src/vllm_router/utils.py src/tests/test_utils.py
  • With only the one-line fix reverted: 5 failed, 14 passed, 12 deselected.
  • With the fix: 19 passed, 12 deselected; related suite: 56 passed.
  • Pre-commit: 6 passed, 8 skipped because no files matched. git diff --check is clean.

Overlap checked: open and closed PRs and issues for validate_url, "single-label", "Skipping invalid URL", "static-backends" hostname, "docker compose" hostname, and "invalid URL". Only #737 addresses this bug. Main has no later fix, and there are no maintained release branches.

Not tested: deployed inference, end-to-end routing, or Helm functionality.

Related issues: N/A; this follows #737.


  • Code changes pass the applicable pre-commit checks.
  • Commit includes the DCO sign-off.
  • PR title uses the [Bugfix][Router] prefixes.

Carry vllm-project#737 forward with guarded single-label hostnames and remove the
redundant localhost alternative. Preserve existing multi-label inputs.
Cover URL validation and static backend filtering in the utility tests.

Co-authored-by: Abdullah AlOsaimi <abdullah@osaimi.dev>
Co-authored-by: Rui Zhang <51696593+ruizhang0101@users.noreply.github.com>
Signed-off-by: spicysharkco <321699413+spicysharkco@users.noreply.github.com>

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates the URL validation regex in src/vllm_router/utils.py to support single-label hostnames (ensuring they do not start or end with a hyphen) and removes the explicit localhost match since it is covered by the new pattern. It also adds comprehensive unit tests in src/tests/test_utils.py to verify this behavior. There are no review comments, so I have no feedback to provide.

@Mazyod

Mazyod commented Oct 20, 2026

Copy link
Copy Markdown

Thanks for picking this up. We run the router with single-label backend names (http://vllm-worker:8000) in Docker and Kubernetes and carry an equivalent fix in our deployment. This PR carries forward #737's existing fix and adds tests and a signed-off replacement commit; we're happy to close #737 in favor of it.

@ruizhang0101 the workflow runs here currently show action_required; could you approve them?

@osaimi

osaimi commented Oct 20, 2026

Copy link
Copy Markdown

#737 is closed in favor of this pr.

Mazyod pushed a commit to Mazyod/production-stack that referenced this pull request Oct 20, 2026
…laybook

Point the single-label hostname patch at upstream PR vllm-project#1154, which
superseded the now-closed vllm-project#737. Record that the DNS resolver change is
proposed upstream for the shared client only (vllm-project#1161/vllm-project#1162), and that
upstream vllm-project#1164's 503 must not replace the fork's documented 502 envelope
on a refresh. Add the evidence-based playbook for getting fixes merged
upstream. Docs only; does not trigger an image release. Standard
pre-commit hooks pass on the changed files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5cnah4yC2sS7LEZ8mdrTd
Signed-off-by: ci-sim <ci@sim>

This branch has not been deployed

No deployments
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