Skip to content

Fix Swagger UI URL for wildcard host binds#706

Open
liuzemei wants to merge 1 commit into
Lightning-AI:mainfrom
liuzemei:fix-swagger-ui-localhost-display
Open

Fix Swagger UI URL for wildcard host binds#706
liuzemei wants to merge 1 commit into
Lightning-AI:mainfrom
liuzemei:fix-swagger-ui-localhost-display

Conversation

@liuzemei

@liuzemei liuzemei commented Jun 7, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #697.

When LitServer.run() binds to a wildcard host like 0.0.0.0 or ::, the server should keep that bind address but print a browser-reachable Swagger UI URL. This changes the displayed docs URL to use localhost for wildcard binds while preserving explicit 127.0.0.1 output.

Tests

  • .venv/bin/python -m pytest tests/unit/test_swagger_ui_display_url.py -q
  • .venv/bin/python -m py_compile src/litserve/server.py tests/unit/test_lit_server.py tests/unit/test_swagger_ui_display_url.py
  • git diff --check

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.

invalid ip address for windows during local debugging

2 participants