Welcome! Log In Create A New Profile

Advanced

Re: Caching result of auth_request_set?

Maxim Dounin
July 21, 2018 10:54PM
Hello!

On Fri, Jul 20, 2018 at 03:42:40PM -0400, jarstewa wrote:

> I'm currently using the auth_request directive and caching the result based
> on a guid + IP address:
>
> >location /auth {
> > internal;
> >
> > proxy_pass_request_body off;
> > proxy_pass $upstream_server/auth?id=$guid&requestor=$last_client_ip;
> >
> > proxy_cache auth_cache;
> > set $auth_cache_key "${guid}|${last_client_ip}";
> > proxy_cache_key $auth_cache_key;
> > proxy_cache_valid 200 301 302 5m;
> > proxy_cache_valid 401 403 404 5m;
> >
> >}
>
> It would be very convenient for me to return back a bit of metadata
> associated with the guid from the upstream auth request, and send that bit
> of metadata along with the actual request that will follow if the auth
> subrequest succeeds. It looks like this is possible via the
> auth_request_set directive, but I am not sure how auth_request_set would
> interact with proxy_cache.
>
> For auth requests, is proxy cache only caching the HTTP response code? Or
> is it caching the full response including variables? In other words, will
> auth_request_set still work correctly to set a variable when the auth
> response is cached? Thank you!

Unless it is specifically instructed to intercept errors using the
proxy_intercept_errors directive, proxy cache caches full response
as get from the upstream server. That is, auth_request_set is
expected to work just fine.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Caching result of auth_request_set?

jarstewa July 20, 2018 03:42PM

Re: Caching result of auth_request_set?

Maxim Dounin July 21, 2018 10:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready