Content says to cache, but still hitting back-end server

Issues related to applications and software problems
Post Reply
sawozny
Posts: 48
Joined: 2019/07/13 22:19:14

Content says to cache, but still hitting back-end server

Post by sawozny » 2021/02/01 21:41:40

Any CentOS running Apache gurus out there? I have a setup where I have an “external” Apache httpd (CentOS 7; Apache 2.4) server that handles SSL, has CacheEnable disk “/” configured and is a reverse proxy with a Proxy balancer object and one BalancerMember which is an “internal” Apache httpd server running php-fpm and serving the actual web content over port 80 to the external server, as needed.

The goal of this configuration is to use the default max-age=3600 caching on the external server which will apply to all requests EXCEPT those I will override with Cache-Control: no-store headers on specific pages that have dynamic content I don’t want cached, leaving js files, style sheets, images, etc… as cacheable to take some load off my back-end servers so they can focus on running PHP, talking to DB servers, etc…

This all works great in theory and when I load pages and look at the headers in Firefox dev tools, the Cache-Control headers are exactly as I want them to be for each page and each type of content (dynamic pages show Cache-Control: no-store in the header, but everything else shows Cache-Control: max-age=3600), BUT when I take a look at the internal server’s access_log, I see the external server asking for and receiving content that it SHOULD be serving to the client from it’s own cache immediately after getting a fresh copy from the internal server. No matter how many times in the 3600 second window I ask for the resource, again, the proxy asks for a fresh copy from the internal server EVERY time, rather than serving from cache.

Any suggestions of what I might be doing wrong here, where I should be looking for trouble or what data I should provide here to assist in guiding the troubleshooting effort?

Thanks,

Scott

Post Reply

Return to “CentOS 7 - Software Support”