Skip to content

feat: support http_method and http_req_body in active health checks - #13726

Merged
AlinsRan merged 3 commits into
apache:masterfrom
AlinsRan:feat/healthcheck-probe-method-body
Jul 23, 2026
Merged

feat: support http_method and http_req_body in active health checks#13726
AlinsRan merged 3 commits into
apache:masterfrom
AlinsRan:feat/healthcheck-probe-method-body

Conversation

@AlinsRan

Copy link
Copy Markdown
Contributor

Description

The active health-check probe is currently hard-coded to a bodyless GET. This PR bumps lua-resty-healthcheck-api7 to 3.2.3 and exposes two new fields on upstream.checks.active so a probe can be sent as any HTTP method with a request body:

  • http_method — default GET
  • http_req_body — default ""; a non-empty body adds a matching Content-Length header

This lets an upstream be probed with a real request instead of a bare GET — for example, health-checking an LLM provider through ai-proxy-multi with an actual chat-completion POST body.

Defaults keep the previous GET-without-body behavior, so it is backward compatible.

Changes

  • apisix-master-0.rockspec: lua-resty-healthcheck-api7 3.2.2-03.2.3-0
  • apisix/schema_def.lua: add http_method / http_req_body to health_checker_active (moved method_schema up so the enum can be reused)
  • docs/.../health-check.md: document the two fields
  • t/plugin/ai-proxy-multi3.t: add a test that configures a POST-body probe and asserts the target receives the expected method / headers / body
  • t/plugin/ai-proxy-vertex-ai.t: 3.2.3 changed the probe debug log label from request head: to request:; update the assertion

Notes

3.2.3 is a backward-compatible superset of 3.2.2 (the probe request is byte-identical for the default GET-without-body case; the only behavioral change for existing users is the debug log label).

Bump lua-resty-healthcheck-api7 to 3.2.3, which lets an active health-check
probe be sent as any HTTP method with a request body instead of a bodyless
GET. Expose the two new fields on `upstream.checks.active`:

- `http_method` (default "GET")
- `http_req_body` (default ""), a non-empty body adds a Content-Length header

This lets ai-proxy-multi (and any upstream) probe an endpoint with a real
request -- e.g. health-check an LLM provider with a chat-completion POST body.
Defaults keep the previous GET-without-body behavior, so it is backward
compatible.

3.2.3 also changes the probe debug log label from "request head:" to
"request:"; update the ai-proxy-vertex-ai assertion accordingly.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 22, 2026
AlinsRan added 2 commits July 22, 2026 15:28
An inline [[..]] route JSON this large trips OpenResty 1.29's config-parser
long-bracket buffer (nginx fails to start: 'Lua code block missing the closing
long bracket'). Build the route as a Lua table encoded with core.json.encode
instead.

@membphis membphis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@AlinsRan AlinsRan self-assigned this Jul 23, 2026
@AlinsRan
AlinsRan merged commit 6125bf3 into apache:master Jul 23, 2026
20 of 21 checks passed
@AlinsRan
AlinsRan deleted the feat/healthcheck-probe-method-body branch July 23, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants