1

The problem is getting proxied content to be cached by Apache 2.4.

This problem was solved for Apache 2.2 (i.e. use mod_mem_cache). But in Apache 2.4 mod_mem_cache was removed.

My upstream content source is http://10.1.1.123:8081/data/ and it is configured in Apache like this:

Alias /data /var/www/html/index.php

The data index.php works like this:

root@orac:/var/www/html# cat index.php
<?php

$expires = time() + 5;
$expires = gmdate( 'D, d M Y H:i:s', $expires ) . ' GMT';

header( 'Content-Type: text/html; charset=utf-8' );
header( "Expires: {$expires}" );

echo $expires;

i.e. it expires content after five seconds since requested.

If I access /data directly (from my web browser) the five second caching works.

In Apache my proxy configuration looks like this:

ProxyPass /cache/ http://10.1.1.123:8081/data/
ProxyPassReverse /cache/ http://10.1.1.123:8081/data/

And my caching configuration looks like this:

CacheEnable disk /
CacheRoot "/var/cache/mod_proxy"
CacheDirLevels 3
CacheDirLength 5
CacheIgnoreCacheControl On
CacheMaxFileSize 100000000
CacheIgnoreNoLastMod O

The cache store is writeable by www-data:

root@orac:/var/cache/mod_proxy# ls -al
total 8
drwxr-xr-x  2 www-data www-data 4096 Jun  5 13:41 .
drwxr-xr-x 19 root     root     4096 Jun  5 13:41 ..

Can anyone help me out with this?

John Elliot V
  • 333
  • 2
  • 10

0 Answers0