July 20, 2018 03:42PM
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!
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: 249
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