openresty / openresty/lua-nginx-module
HTTP/2 protocol error if headers are sent before a Lua error
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
Relevant section of the OpenResty 1.19.9.1 config:
location @error {
content_by_lua_file /var/www/lua/error.lua;
}
location / {
error_page 500 @error;
content_by_lua_file /var/www/lua/content.lua;
}
error.lua:
ngx.say(tostring(ngx.status))
content.lua:
ngx.send_headers()
error('hi')
Trying to curl https://localhost results in:
curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)
curl https://localhost --http1.1 (or --http1.0):
curl: (52) Empty reply from server
Commenting out the call to ngx.send_headers() results in the request completing successfully and printing 500.
Using echo instead of content_by_lua* in the @error named location doesn't solve the issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the configuration using content.lua and error.lua, starting with the ngx.send_headers() and error('hi') sequence and the @error location. Compare the HTTP/2 and HTTP/1.x curl results; done means the request reaches the error handler and returns 500 without an INTERNAL_ERROR or empty reply.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua, nginx
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100