Closed (won't fix)
Project:
Authenticated User Page Caching (Authcache)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 Oct 2014 at 07:30 UTC
Updated:
30 Apr 2021 at 16:16 UTC
Jump to comment: Most recent
Comments
Comment #1
dropchew commentedComment #2
znerol commentedI expect the tricky part to be the nginx configuration. The problem is that the authcache key needs to be part of the
fastcgi_cache_key. Imagine something like the following:fastcgi_cache_key "$scheme$request_method$authcache_key$request_uri";
In the past I've tried several methods to maintain the authcache key for a user. In earlier versions the key was always set as a cookie in the users browser. Authcache Boost still uses that method. I think that this would be relatively easy to implement in nginx config. It would be necessary to sanitize the cookie value (either by comparing it to a list of possible values or with a regex) and then set the
$authcache_keyvariable to the sanitized value. If it is empty or invalid, set it to$host.The second approach is to always execute two requests, the first fetches the key and the second the page. Obviously the first request will be cached in most cases. This is what is implemented in the VCL and by Authcache Varnish. If it is possible to initiate cacheable HTTP request from nginx config, then this would also be an option.
Another thing to consider is how to expire pages from the Nginx fastcgi cache. If a user posts a comment, the affected page needs to be removed from the cache. This would be the equivalent of the
bancommand in Varnish. Is there something like that in Nginx?Comment #3
dropchew commentedYes its possible using nginx compiled with nginx cache purge module (https://github.com/FRiCKLE/ngx_cache_purge) or the custom method mentioned in https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-ca...
I have managed to set a separate cache for each login session using the below. But not sure how can it be integrated with authcache
nginx conf
Comment #4
cromulus commentedthe ngx_cache_purge module isn't needed.
As long as you know the key used to create the cache, you can purge directly using php:
see here:
https://github.com/rtCamp/nginx-helper/blob/master/purger.php
Comment #5
znerol commented