Skip to content

[Serve] Route HAProxy ingress through request routers - #66592

Merged
eicherseiji merged 3 commits into
masterfrom
seiji/haproxy-ingress-router-dispatch
Oct 15, 2026
Merged

eicherseiji merged 3 commits into
masterfrom
seiji/haproxy-ingress-router-dispatch

Conversation

@eicherseiji

Copy link
Copy Markdown
Contributor

Summary

Make HAProxy consult an application's ingress request router for every HTTP request, independent of method. Forward end-to-end request headers while filtering hop-by-hop/framing fields, and pin the returned replica.

Request-body forwarding remains separately opt-in for body-aware routers.

Tests

  • Real-HAProxy coverage for POST, GET, header forwarding/filtering, and replica pinning
  • Focused pre-commit and HAProxy Lua/config validation
  • Full pytest requires CI because the local compiled Ray extension predates this checkout

Duplicate search

No open duplicate found.

AI assistance

AI assistance was used; the changes require submitter review before this draft is marked ready.

@eicherseiji
eicherseiji force-pushed the seiji/haproxy-ingress-router-dispatch branch from 1acc240 to a038e7f Compare September 30, 2026 00:57
@eicherseiji eicherseiji added the go add ONLY when ready to merge, run all tests label Sep 30, 2026
@eicherseiji
eicherseiji force-pushed the seiji/haproxy-ingress-router-dispatch branch from a038e7f to 27723f4 Compare September 30, 2026 22:45
@eicherseiji
eicherseiji marked this pull request as ready for review October 1, 2026 17:40
@eicherseiji
eicherseiji requested a review from a team as a code owner October 1, 2026 17:40

@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 HAProxy ingress request router to support routing for all HTTP methods instead of only POST requests. It replaces the specific session and request ID forwarding logic with a general mechanism that forwards client request headers (excluding hop-by-hop headers) and the multiplexed model ID to the internal router. The feedback points out a potential runtime error in the Lua script where calling :lower() on a nil token match (which can occur if a token contains a newline) could cause a crash, and suggests safely verifying the match before transforming it.

@harshit-anyscale

Copy link
Copy Markdown
Contributor

@eicherseiji can it have any impact on the latencies? if yes, can we run the staging load test on it once?

@eicherseiji

Copy link
Copy Markdown
Contributor Author

The hot path is POST, which already goes through /internal/route today. This change only adds header serialization on that path, which should be negligible compared with the existing router call and inference work. GET and other non-POST methods will now pay the router round trip, but they are not on the hot path; routing them is needed for correctness. Given that, I don’t think a staging load test would provide much useful signal for this change.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3627426. Configure here.

for _, value in pairs(connection) do
for token in value:gmatch("[^,]+") do
excluded[token:match("^%s*(.-)%s*$$"):lower()] = true
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Header iteration may crash routing

High Severity

request_headers_for_router walks HAProxy req_get_headers() value tables with pairs and calls string methods on every entry. Those tables are 0-indexed and historically include a numeric used count. A normal Connection header would then throw in the Lua action and fail routing for typical HTTP/1.1 traffic.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3627426. Configure here.

@eicherseiji
eicherseiji merged commit 7af74ca into master Oct 15, 2026
6 checks passed
@eicherseiji
eicherseiji deleted the seiji/haproxy-ingress-router-dispatch branch October 15, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants