Can't Partially Load PDFs from pdf.js

My site sends books as pdfs and their sizes are fairly large (3MB - 20MB). I’m trying to load them in chunks so the user can start viewing the pdf before the whole file loads. It’s working when I deploy locally, but not when I deploy through Netlify.

Any advice on what might be going wrong would be much appreciated! I’m new to Netlify, so advice on how to debug Netlify problems would also be great. I just discovered Netlify Dev and am checking that out.

PDF loading on website
Git repository

I am using disableAutoFetch and disableStream so that pdf.js only loads the content the user is viewing.
image

Below you can see this working when I run locally. The pdf file is transferred in small chunks, mostly around 60kb. The pdf is viewable around 1.3s and a total of 1.2MB is transferred.


image

And below you can see this not working when I deploy on Netlify. The pdf is loaded as one 4.5MB file. The pdf isn’t viewable for around 4s and a total of 5.1MB is transferred.


image

And finally, below you can see the documentation for the pdf.js settings I’m using.
image

Thanks!

Hi, @morellaj. I cannot see the details of the working requests compared to the requests at Netlify.

Would you be willing to collect HAR files of both the working and non-working versions and then send those files to me? Please feel free to private message (PM) me if you don’t want to share the files publicly.