3

I'm having a problem getting the caching I need to work using CloudFlare.

We use CloudFlare for caching all our assets on S3 which works 100% using a separate subdomain cdn We also use CloudFlare for our main site (hosted on Heroku) as well, e.g. www

My problem is I can't get CloudFlare to cache PDFs that are generated from our Rails app. I'm using the WickedPDF gem to dynamically generate certain PDFs for invoices, etc. I don't want to upload these as files to say S3 but we would like to have CloudFlare cache these so they don't get generated each and every time, as the time spent generating these PDFs is a little intensive.

CloudFlare is turned on and is "accelerating" for the subdomain in question and we're using SSL, but PDFs never seem to cache properly.

Is there something else we need to do to ensure these get cached? Or maybe there's another solution that would work for Heroku? (eg we can't use Page caching since it relies on the filesystem) I also checked the WickedPDF documentation so see if we could do anything else, but found nothing about expire controls.

Thanks,

holden
  • 13,471
  • 22
  • 98
  • 160
ere
  • 1,739
  • 3
  • 19
  • 41

1 Answers1

1

We should actually cache it as long as the resources are on-domain & not being delivered through a third-party resource in some way.

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

I would open a support ticket if you're still having issues.

damoncloudflare
  • 2,079
  • 13
  • 9