AlinsRan opened a new pull request, #14185:
URL: https://github.com/apache/apisix/pull/14185
### Description
With the default `ngx_http_ffi_client`, a `forward-auth` route configured
with `keepalive: false` still sends `Connection: keep-alive` to the auth
service. The gateway does close the connection after the response, but the
header tells the auth service otherwise, which contradicts the plugin docs
("`close` when `keepalive` is `false`").
Cause: `request_auth()` goes through the object API (`connect` / `request` /
`close`). `ngx_http_ffi_client` frames every request with `Connection:
keep-alive` unless the caller passes its own `Connection` header, and
`request_auth()` never passed the keepalive intent to it.
Fix: when `keepalive` is `false` and the client is `ngx_http_ffi_client`,
send `Connection: close`. `lua-resty-http` keeps its current behaviour (no
`Connection` header in either case).
### Tests
`t/plugin/forward-auth4.t`: the auth service now reports the `Connection`
header it received.
- TEST 2: the default client sends `keep-alive`.
- TEST 8: `keepalive: false` sends `close` (fails without the fix).
- TEST 11: `lua-resty-http` sends no `Connection` header.
- TEST 22 (new): `lua-resty-http` with `keepalive: false` sends no
`Connection` header and does not reuse the connection.
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change (no change
needed: the docs already describe this behaviour)
- [x] I have verified that this change is backward compatible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]