New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Static File Cache keeps regenerating

Sebastian Butt March 30, 2020 by Sebastian Butt

Hi everyone,

I´m having problems with the Static File Caching on my Webserver. As long as I run the site on my local computer everything works fine the Cache folder is generated and it´s filled with _.html files, which are then served on the next page call within 2ms or something.

After uploading the site to my webserver the cache files are still generated correctly but with EVERY page call. The files are being regenerated over and over again. so that the cached files are actually never served. They always get refreshed. The loading times are around 220ms for each page call, close to serving with no cache at all. Using Cache Type: Cache I got around 120ms per call which is nice but static caching should still be much faster.

I´m serving the Site above Webroot in a "public" folder. The cache folder is set to public/static

My caching.yaml looks like this:

stache_always_update: true

cache_tags_enabled: false

static_caching_enabled: true

static_caching_type: file

static_caching_file_path: public/static

static_caching_ignore_query_strings: false

stache_lock_enabled: true

stache_lock_wait_length: 30

static_caching_lock_hold_length: 0

And the .htaccess is served with the Static Cache part active: RewriteCond %{DOCUMENT_ROOT}/static/%{REQUEST_URI}%{QUERY_STRING}.html -s RewriteCond %{REQUEST_METHOD} GET RewriteRule .* static/%{REQUEST_URI}%{QUERY_STRING}.html [L,T=text/html]

The apache Version is: Apache 2.4.41 PHP: 7.3 Statamic: 2.11.20

does anyone have an idea why this might happen? Saddly there are no errors in the Log files. I thought it had something to do with the static_caching_lock_hold_length parameter but changing it does not seem to help. Do I have to edit the path in the htaccess file? I played with public/static/%request... but that did not do anything either :( Sadly I can't access the apache config on my Webhost.

best regards, Sebastian

Answered by Sebastian Butt!
>>>>>>> Answered <<<<<<<
4 Replies