fix: remove stale HTTP/2 body guard#13428
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Removes an APISIX-side HTTP/2/HTTP/3 Content-Length precondition in core.request.get_body() that was originally added as a workaround for older lua-nginx-module behavior, aligning APISIX with current OpenResty behavior where ngx.req.read_body() works without Content-Length for HTTP/2/3.
Changes:
- Removed the HTTP/2/HTTP/3 “missing Content-Length” guard from
apisix/core/request.lua. - Updated the azure-functions plugin tests to stop injecting
Content-Length: 0for HTTP/2 requests and removed the now-stale negative test that expected a 400 error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| t/plugin/azure-functions.t | Drops test-only Content-Length: 0 headers for HTTP/2 and removes the test that asserted the old guard behavior. |
| apisix/core/request.lua | Removes the stale HTTP/2/HTTP/3 missing Content-Length rejection from get_body(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AlinsRan
approved these changes
May 25, 2026
shreemaan-abhishek
approved these changes
May 25, 2026
membphis
approved these changes
May 26, 2026
This was referenced Jun 11, 2026
wistefan
pushed a commit
to wistefan/apisix
that referenced
this pull request
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
core.request.get_body()still rejects HTTP/2 and HTTP/3 requests without aContent-Lengthheader, but that guard was added for an older lua-nginx-module behavior that has since been reverted upstream.Current lua-nginx-module no longer rejects
ngx.req.read_body()for HTTP/2 or HTTP/3 requests withoutContent-Length, so APISIX should not reject those requests at its own request helper layer. This also matches the discussion in #11362, where the reported behavior was already stale for newer OpenResty releases.This removes the stale guard and drops the test-only
Content-Length: 0headers that were added for it.Which issue(s) this PR fixes:
Fixes #11362
Checklist
Fixes #13237