Repository navigation
[Serve] Enable HAProxy by default on Linux - #66590
eicherseiji wants to merge 1 commit into
Conversation
bd5d6d4 to
bdf77ef
Compare
bdf77ef to
fcfe8a8
Compare
fcfe8a8 to
9d93e74
Compare
9d93e74 to
542822f
Compare
542822f to
7f6edbb
Compare
7f6edbb to
489fe8f
Compare
be6ef5f to
94e7b77
Compare
94e7b77 to
1f2a827
Compare
1f2a827 to
ad01b33
Compare
There was a problem hiding this comment.
Code Review
This pull request enables HAProxy by default on Linux for Ray Serve, while keeping the Python proxy as the default on other platforms. It introduces an automatic fallback to the Python proxy when TLS is configured, since HAProxy does not terminate TLS, and updates the documentation and tests accordingly. Feedback on the changes highlights a bug in the TLS fallback logic where an incorrect warning about HAProxy not terminating TLS could be logged even if HAProxy was explicitly disabled in the controller's runtime environment variables.
| haproxy_was_enabled = ( | ||
| RAY_SERVE_ENABLE_HA_PROXY or env_vars.get(_ENABLE_HAPROXY_ENV_VAR) == "1" | ||
| ) |
There was a problem hiding this comment.
If RAY_SERVE_ENABLE_HA_PROXY is globally enabled (e.g., on Linux), but a user explicitly disables it in controller_options.runtime_env["env_vars"] by setting "RAY_SERVE_ENABLE_HA_PROXY": "0", haproxy_was_enabled will still evaluate to True due to the or condition. This leads to an incorrect and misleading warning being logged about HAProxy not terminating TLS, even though the user already explicitly opted out of HAProxy.
We should respect the override in env_vars if it is present, and only fall back to the global RAY_SERVE_ENABLE_HA_PROXY constant if it is absent.
| haproxy_was_enabled = ( | |
| RAY_SERVE_ENABLE_HA_PROXY or env_vars.get(_ENABLE_HAPROXY_ENV_VAR) == "1" | |
| ) | |
| haproxy_was_enabled = ( | |
| env_vars.get(_ENABLE_HAPROXY_ENV_VAR) == "1" | |
| if _ENABLE_HAPROXY_ENV_VAR in env_vars | |
| else RAY_SERVE_ENABLE_HA_PROXY | |
| ) |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
Signed-off-by: Seiji Eicher <[email protected]>
ad01b33 to
71ac24a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 71ac24a. Configure here.
| RAY_SERVE_ENABLE_HA_PROXY = ( | ||
| os.environ.get("RAY_SERVE_ENABLE_HA_PROXY", "1" if sys.platform == "linux" else "0") | ||
| == "1" | ||
| ) |
There was a problem hiding this comment.
Default HTTP bind becomes public
High Severity
Enabling HAProxy by default on Linux also replaces the implicit HTTP host with all interfaces through DEFAULT_HTTP_HOST. HTTPOptions and serve.start still describe that default as localhost, so Linux users who omit host now expose Serve on the network instead of loopback.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 71ac24a. Configure here.


Summary
Enable HAProxy by default on Linux. macOS and Windows remain on the Python proxy, and Linux users can opt out with
RAY_SERVE_ENABLE_HA_PROXY=0.TLS configuration automatically falls back to the Python proxy because HAProxy does not yet terminate TLS. This TLS fallback can be removed when HAProxy supports TLS.
Fake multi-node placement tests use a head-only proxy because their logical worker nodes share one host.
Tests
The standard suite remains pinned to the Python proxy so it continues to cover that supported path, including the TLS fallback. Without the explicit pin, changing the Linux default would silently move the existing suite to HAProxy and leave Python-proxy regressions uncovered. A separate HAProxy suite runs the same Serve targets to cover the new default path.
RAY_SERVE_ENABLE_HA_PROXY=0RAY_SERVE_ENABLE_HA_PROXY=1and runs the same Serve targetsray._rayletDuplicate search
No open duplicate found for enabling HAProxy by default.
AI assistance
AI assistance was used; the changes require submitter review before this draft is marked ready.