Welcome! Log In Create A New Profile

Advanced

Re: Actions after cache miss is detected

Maxim Dounin
August 12, 2018 05:28PM
Hello!

On Fri, Aug 10, 2018 at 09:05:30AM -0700, Roger Fischer wrote:

> Is there a way to perform an action after a cache miss is
> detected but before the request is forwarded to the upstream
> server?
>
> Specifically, on a cache miss I want to:
> Return a response instead of forwarding the request to the
> upstream server.
> Trigger a handler (module or script) that executes
> asynchronously to the request.
>
> The latter I could do by looking at the logs. But I was
> wondering if there is a more elegant way.

There is no direct way to do this. There are multiple of ways to
do this indirectly though, including:

- configure a backend which returns a non-cacheable response and
triggers appropriate actions;

- configure a non-responding backend and error_page 502 to return
a response and trigger appropriate processing.

Alternatively, in some cases it might be more convenient to use
proxy_store instead of proxy_cache, and then work with responses
on the file system - with try_files and so on.

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

Actions after cache miss is detected

Roger Fischer August 10, 2018 12:08PM

Re: Actions after cache miss is detected

Maxim Dounin August 12, 2018 05:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 297
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