Question about IF and auth subrequest

Vincent Blondel vbl5968 at
Wed Feb 24 09:39:57 UTC 2021

Hello all,
I have a quick question about the usage of IF and auth_request.
I would like to know if it is possible to use a IF statement to condition
the proxy behaviour of one /location depending on the response headers of
the sub auth request ...

location /subrequest/ {
    proxy_pass xxx;
location /anyrequest/ {
    auth_request /subrequest/;

    if ($response_header ~ '' ) {
      proxy_pass_request_body off;
      proxy_set_header Content-Length "";
      proxy_pass ...
    if ($response_header !~ '' ) {
      proxy_pass xxx;

Thank You in advance for your Support ...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list