mod_cache for FallbackResource?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

using php/fcgi, I've a Content Management System whose entry-point is /index.php
On the Apache-side it makes use of FallbackResource

According to the documentation:
> As a filter, mod_cache can be placed in front of content originating
> from any handler, including flat files (served from a slow disk cached
> on a fast disk), the output of a CGI script or dynamic content
> generator, or content proxied from another server.


I want to benefit from this fine grained control and configure it as:

> <VirtualHost *:80>
>     ServerName website
>     DocumentRoot "/var/www/website"
>     <Directory "/var/www/website">
> 	Require all granted
> 	AllowOverride None
> 	<FilesMatch \.php$>
> 	    SetHandler "proxy:unix:/var/run/php5-fpm-website.sock|fcgi://blah"
> 	</FilesMatch>
> 	FallbackResource /index.php
>     </Directory>
> 
>     <Proxy fcgi://blah max=5>
>     </Proxy>
> 
>     CacheHeader On
>     CacheDetailHeader On
>     CacheQuickHandler Off
> 
>     <Location "/cacheit">
> 	CacheEnable disk
>     </Location>
> 
>     <Location "/dontcache">
> 	CacheDisable on
>     </Location>
> </VirtualHost>


A sample, not significant, index.php file inside /var/www/website:
> <?php
> $uri = trim($_SERVER['REQUEST_URI'], '/');
> if     ($uri == 'cacheit')   header('Cache-Control: max-age=30');
> elseif ($uri == 'dontcache') header('Cache-Control: no-cache');


There are multiple issues, whatever syntax/order variations is used, like
> `CacheEnable disk /`
at the VirtualHost level.


But the first one being that the <Location> directive are *not* taken into
account.
A sample of mod_cache debug output, when a `GET /dontcache` is issued soon
after `GET /cacheit` (and results in a cached output):
> cache_storage.c(664): AH00698: cache: Key for entity /index.php?(null) is http://website:80/index.php?
> mod_cache_disk.c(572): AH00709: Recalled cached URL info header http://website:80/index.php?
> mod_cache_disk.c(885): AH00720: Recalled headers for URL http://website:80/index.php?
> mod_cache.c(601): AH00761: Replacing CACHE with CACHE_OUT filter for /index.php
> mod_cache.c(652): AH00763: cache: running CACHE_OUT filter
> mod_cache.c(681): AH00764: cache: serving /index.php

Indeed htcacheclean -A only shows one unique version of stored, keyed "index.php"


I did some attempts using `CacheQuickHandler On` and was able to get
distinct cache entries for /cacheit and /dontcache.
That was good but it does not solve the issue of <Location> not being
taken into account (and the CacheEnable flag not being respected):

Eg:
> <Location "/private"> 
>   CacheDisable on
> </Location>
is not respected (wild guess: because /private is not a "real" resource)


Moreover I'd rather stick with a normal cache handler since I hope it'd would
make possible to insert Header/RequestHeader and I also expect to
use things like:
> SetEnvIfNoCase Cookie admin_cookie no-cache
that the CacheQuickHandler would not treat.


Question:
Is there any way to make CacheEnable work on a granular <Location> basis
when a FallbackResource is used and that the <Location> parameter is the
original un-rewritten URL?


Thank you!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux