Disk caching in Apache2 reverse proxying configuration

325 views Asked by At

I'm trying to setup a reverse disk-caching proxy on my apache2 instance, to avoid hitting a publicly available resource too often. The setup is like this:

local-node --(http)--> reverse-proxy --(https)--> original-resource

To achieve this, I did the following setup on reverse-proxy:

<VirtualHost *:80>
  CacheRoot /path/with/www-data/read-write-permissions
  CacheDefaultExpire 86400
  SSLProxyEngine On

  <Location "/location/">
    ProxyPass https://example.com/location/
    ProxyPassReverse https://example.com/location/
    CacheEnable disk
  </Location>

I then enabled modules cache, cache_disk, ssl, proxy, proxy_html, proxy_http.

The apache2 service was properly reloaded and accessing http://reverse-proxy/location/file works on local-node. I see logs on the apache2 server indicating a file from the proxied location being served.

What I do not see is the disk cache being formed. If I list /path/with/www-data/read-write-permissions, then the directory is empty. I'm now worried that the caching is not working as expected I can confirm that this is not working and I continue to hit https://example.com/location/ at every request of local-node to the original file - which I definitely would like to avoid.

Question(s):

  1. How to fix this to enable proper disk caching?
  2. How to ensure that the remote resource is not being hit all the time?
0

There are 0 answers