auth_request sub requests not using upstream keepalive

Zach Rait zach at balbecfilms.com
Sat Jan 29 06:08:45 UTC 2022


Hi--

I was exploring using auth_request from the ngx_http_auth_request_module,
and I have encountered some unexpected behavior with regard to HTTP
keepalive/connection reuse. I have some configuration that looks roughly
like this:

location = /auth_check {
  proxy_pass_request_body off;
  proxy_set_header Content-Length '';
  proxy_http_version 1.1;
  proxy_set_header Connection '';
  proxy_pass https://upstream_with_keepalive_confugred;
}

location /private {
  auth_request /auth_check;
  proxy_pass http://some_backend;
}

When I make a series of requests to /auth_check, nginx uses an existing
connection as confirmed by tcpdump, but when I make a series of requests to
/private, each /auth_check is closing the TCP connection at the end and
then creating a new one for the following request. In my
particular use-case this leads to approximately double the latency of the
calls that use auth_request. Is this the expected behavior/a known issue
with auth_request/http subrequests in general?

Thank you,
Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220128/05174aaf/attachment.htm>


More information about the nginx mailing list