senny / pdfjs_viewer-rails

PDF.js viewer packaged as a Rails engine.
MIT License
114 stars 175 forks source link

pdf.worker.js is not cached by CDN #63

Open abhishek77in opened 4 years ago

abhishek77in commented 4 years ago

I have configured CDN for my app, but pdf.worker.js and other static files are still hitting the rails server. How do I avoid this?

abhishek77in commented 4 years ago

PDF js files are heavy and using CDN would improve the performance.

https://github.com/mozilla/pdf.js#including-via-a-cdn

mozilla_pdf_js__PDF_Reader_in_JavaScript

abhishek77in commented 4 years ago

Hi, upon further investigations I can see assets on which stylesheet_link_tag eg is used are setting the cache-control headers correctly but assets which are linked directly do not set any cache-control headers eg.

This is an issue in production as viewer loads several different static files (around 35 files) which have to be downloaded from the origin server instead of being downloaded via the CDN.