Welcome! Log In Create A New Profile

Advanced

Re: Serve from cache but fire request to upstream server to increment page view counter

Quintin Par
April 04, 2012 12:10AM
Hi all,

Can someone please help me on this? The pattern is similar to

proxy_cache_use_stale updating

but just that the backend request is a fire-and-forget.

If I am to do this in SSI I’ll end up spending time to service the code
path in SSI whereas there is no much need to that urgently.

The next cache bypass will update it and that’s good enough for me.

-Quintin

On Tue, Apr 3, 2012 at 12:13 PM, Quintin Par <quintinpar@gmail.com> wrote:

> Hi all,
>
> I have a strange case, not sure if this is addressed by nginx yet
>
> My site is cached as follows.
>
> location = / {
>
> proxy_pass http://localhost:82;
>
> proxy_set_header Host $host;
>
> proxy_set_header X-Real-IP $remote_addr;
>
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
> proxy_set_header Accept-Encoding "";
>
> proxy_ignore_headers Set-Cookie;
>
> proxy_ignore_headers Cache-Control;
>
> proxy_ignore_headers Expires;
>
> proxy_ignore_headers X-Accel-Expires;
>
> add_header X-Cache-Status $upstream_cache_status;
>
> proxy_cache cache;
>
> proxy_cache_key
> $scheme$host$request_uri$cookie_site_sessionid;
>
> proxy_cache_valid 200 302 30s;
>
> proxy_cache_use_stale updating;
>
> }
>
> One issue I encounter with this is that I can’t increment the page view
> counter that I maintain in redis.
>
> Is there is way nginx can fire a request to the backend web – to some URI
> so that I can take the request and increment the associated counter?
>
> I know I can achieve this with SSI, but I wanted to check if there is a
> better pattern.
>
> -Quintin
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Serve from cache but fire request to upstream server to increment page view counter

Quintin Par April 03, 2012 02:46AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Quintin Par April 04, 2012 12:10AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Antonio P.P. Almeida April 04, 2012 04:10AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Quintin Par April 04, 2012 08:18AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Antonio P.P. Almeida April 04, 2012 08:22AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Jonathan Matthews April 04, 2012 08:28AM

Re: Serve from cache but fire request to upstream server to increment page view counter

Quintin Par April 04, 2012 11:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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