fix: content-length 16 not 15, remove 'timeout check' (not valid in haproxy 2.4 server line)

This commit is contained in:
2026-04-12 17:29:08 +00:00
parent 725e61d792
commit 6476c9c12a
2 changed files with 4 additions and 4 deletions

View File

@@ -73,7 +73,7 @@ echo ""
# haproxy errorfile format: HTTP/1.x status_code reason\r\nheaders\r\n\r\nbody # haproxy errorfile format: HTTP/1.x status_code reason\r\nheaders\r\n\r\nbody
mkdir -p /tmp/haproxy-errors mkdir -p /tmp/haproxy-errors
printf "HTTP/1.0 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n" > /tmp/haproxy-errors/200-empty.http printf "HTTP/1.0 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n" > /tmp/haproxy-errors/200-empty.http
printf "HTTP/1.0 503 Service Unavailable\r\nContent-Length: 15\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nSGLang not ready" > /tmp/haproxy-errors/503-sglang.http printf "HTTP/1.0 503 Service Unavailable\r\nContent-Length: 16\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nSGLang not ready" > /tmp/haproxy-errors/503-sglang.http
# Write haproxy config (compatible with haproxy 2.4) # Write haproxy config (compatible with haproxy 2.4)
HAPROXY_CFG="/tmp/haproxy-shim.cfg" HAPROXY_CFG="/tmp/haproxy-shim.cfg"
@@ -109,7 +109,7 @@ frontend proxy
backend sglang backend sglang
option httpchk GET /health option httpchk GET /health
http-check expect status 200 http-check expect status 200
server s1 127.0.0.1:${SGLANG_PORT} check inter 5s fall 3 rise 2 timeout check 3s server s1 127.0.0.1:${SGLANG_PORT} check inter 5s fall 3 rise 2
EOF EOF
echo "haproxy config written to ${HAPROXY_CFG}" >> "$LOG_PATH" echo "haproxy config written to ${HAPROXY_CFG}" >> "$LOG_PATH"

View File

@@ -76,7 +76,7 @@ def main():
with open("/tmp/haproxy-errors/200-empty.http", "w") as f: with open("/tmp/haproxy-errors/200-empty.http", "w") as f:
f.write("HTTP/1.0 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n") f.write("HTTP/1.0 200 OK\r\nContent-Length: 0\r\nConnection: close\r\n\r\n")
with open("/tmp/haproxy-errors/503-sglang.http", "w") as f: with open("/tmp/haproxy-errors/503-sglang.http", "w") as f:
f.write("HTTP/1.0 503 Service Unavailable\r\nContent-Length: 15\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nSGLang not ready") f.write("HTTP/1.0 503 Service Unavailable\r\nContent-Length: 16\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nSGLang not ready")
# Write haproxy config (compatible with haproxy 2.4) # Write haproxy config (compatible with haproxy 2.4)
haproxy_cfg = "/tmp/haproxy-shim.cfg" haproxy_cfg = "/tmp/haproxy-shim.cfg"
@@ -112,7 +112,7 @@ frontend proxy
backend sglang backend sglang
option httpchk GET /health option httpchk GET /health
http-check expect status 200 http-check expect status 200
server s1 127.0.0.1:{sglang_port} check inter 5s fall 3 rise 2 timeout check 3s server s1 127.0.0.1:{sglang_port} check inter 5s fall 3 rise 2
""") """)
with open(log_path, "a") as f: with open(log_path, "a") as f: