Caching PDF on Hero with Cloud Flair

I have a caching problem that I have to work with using CloudFlare.

We use CloudFlare to cache all of our assets on S3, which runs 100% using a separate subdomain cdn

We also use CloudFlare for our main site (hosted on Heroku) as well for example.www

My problem: I can't get CloudFlare to cache PDFs generated from our Rails application. I am using the WickedPDF gem to dynamically generate specific PDFs for invoices, etc. I don't want to download them as files to say S3, but we would like the CloudFlare cache to be such that they don't get generated every time since the time it takes to create these PDFs is a bit intensive.

CloudFlare is enabled and "accelerated" for the subdomain in question, and we are using SSL, but PDFs never seem to be cached properly.

Is there something else that needs to be done to ensure they are cached? Or maybe there is another solution that will work for Heroku? (for example, we cannot use page caching as it depends on the filesystem). I also checked the WickedPDF documentation to see if we can do anything, but nothing was found about the expiration controls.

Thank,

+3


source to share


1 answer


We have to cache it until the resources are in the domain and are not delivered in any way through a third party resource.

Keep in mind: 1. Our caching depends on the number of requests for resources (at least three). 2. Caching is very data center dependent (in other words, if your site receives a lot of traffic in the data center, it will be cached, if your site is not receiving a lot of traffic in another data center, it may not cache).



I would open a support ticket if you still have problems.

+1


source







All Articles