How do I disable compression for PDFs using Nginx? Related question, how do I stop Adobe Reader from automatically opening the PDF, instead of saving it to the hard drive?
First, nginx enables gzip only for text/html by default so there is no compression when serving PDFs You can setup types you want to gzip (remember that for text/html is on always) by:
Second is client side. I can't possibly think a way other then to told user to right-click and save to...
On the second part, you just have to set the Content-Disposition header to supply a preferred filename and the browser will display a save-file dialog.
I don't know how you would cause Nginx to do that, in php I just use this code:
Be sure to use this BEFORE php outputs any data…