I'm using Apache as a reverse proxy for an application running on a local port. I want to cache responses from this application in memory. So requesting the same URL frequently should give me cached responses from Apache, not fresh responses from the application itself. Note: these are dynamic responses to GET requests, not static files. I read the docs and decided to go with Memcached.

Here's my configuration:

CacheEnable socache /
CacheSocache memcache:localhost:11211
CacheHeader on
CacheDefaultExpire 86400
CacheMaxExpire 604800

ProxyRequests     Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
ProxyPass         /  http://localhost:2322/ nocanon
ProxyPassReverse  /  http://localhost:2322/
ProxyPassReverse  /  http://my.domain.com/
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

Somehow, absolutely nothing is being stored in Memcached when I check the stats. What am I doing wrong?

EDIT: also tried CacheEnable socache http://localhost:2322/ without success.


AFAIK this isn't something that can (or should) be done in Apache itself. A dedicated cacher/load balancer like Varnish should be used instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.