Hello @justanotheruser123
Thank you for your inquiry and I am happy to assist you with this.
Those minified files are generated on request and uploaded once generated, and CDN URLs used once they are uploaded.
This, of course, can happen with a delay. It depends on how often the cron fires and if page cache is used. It is a somewhat complex procedure.
The key is that minify files are dynamic, so the way how it works is complex.
You should visit the page as logged in. This way you will find out which minified URLs are used by that page and queue upload process of minified URLs.
Go to the backend and check that the upload queue is empty. If not – process it.
visit the page as logged in again. It should use CDN URLs now.
Now you can purge page cache and visit it as an anonymous user to check that CDN URLs are used by page cached version too.
I hope this helps!
Hi @vmarko,
thanks for your quick reply. The issue was partially resolved by emptying the upload queue manually. However, it only works when I empty the queue manually, the minified files seem to not be uploaded automatically, is that intended?
Also, when logged in, everything works as it should, but when visiting as an anonymous user, I see some files pulled from the server some from the CDN.
I still see these script tags in the inspector:
<script src=”https://example.com/wp-content/cache/minify/3d9a8.js”></script>
but it should be:
<script src=”https://cdn.example.com/wp-content/cache/minify/3d9a8.js”></script>
Any idea what the issue is and how it can be solved?
Hello @justanotheruser123
Can you please share the URL so we can check this?
Have you purged the cache and tried to visit the page as non-logged in?
@vmarko: It’s very weird. I’m basically running in circles. After a few rounds of purging caches, loading the page as logged in and non-logged in user, I got it to work.
I also always get the “The unsuccessful transfer queue has unresolved errors. Empty the queue to restore normal operation.” after loading the website as not logged in user. Whereas as logged in user, it automatically uploads the minified files to the CDN.
At the same time, I ran into another issue, after activating the “cache control headers” and exporting the files to S3 again, the max-age was only set for a few files. So I had to delete the entire S3 bucket content and re-upload it from scratch.
Is there a best practice workflow I should follow? E.g. if I create and / or change a page, what’s the correct order of:
– Purging all caches
– Purging only page cache
– Invalidating CloudFront distribution
– (Re-)Exporting files to S3
– Loading page logged in
– Loading page not logged in
?
Does re-exporting overwrite the metadata of the S3 objects? And does “Purge all caches” also invalidate the CloudFront distribution?
Hello @justanotheruser123
You should add the Cache-Control header to your S3 bucket with value directly on AWS.
W3 Total Cache can purge the CDN cache by sending invalidation requests or just telling it there are new files to be cached. The CDN will understand what to do with it. The option “Only purge CDN manually” was built that because of the problems with invalidation requests on CloudFront causing huge bills. If it’s enabled, you can click the purge CDN button in W3 Total Cache to send invalidation requests, otherwise, all changes will be detected automatically and an invalidation request will be sent immediately.
If you purge all cache it means that minified files will also be rebuilt.
To be able to see the changes you only need to purge page cache to see the changes in the URL of the image/minified file uploaded to S3.
I hope this helps!