I have a site, hosted on Dreamhost, with several pdf files. When I try to open them in Chrome's pdf viewer, the viewer opens but I get a "Failed To Load PDF Document" message or sometimes the view doesn't open at all and I just get a 503 message. On another site that I know to be hosted on Dreamhost I get the same issue. All other content on these sites load fine.
If I use another browser to open with another PDF viewer (Preview or Adobe Reader) the pdfs from my site load fine.
If I try to open pdfs from other sources in Chrome's viewer they work fine.
Is there something I can do on my end to fix this? Is this something likely caused by Dreamhost? Has anybody else had an issue like this?
Although not recommended by Dreamhost, you can resolve this issue by unchecking the "Extra Web Security?" option under "Manage Domains" in the control panel. This feature uses Apache's mod_security
to add request filtering and provide security for your site.
If you still want this feature enabled, you will have to add a .htaccess file in the root of your site to bypass some of the filtering. To allow access to a specific pdf, you would need add something like
<IfModule mod_security.c>
SetEnvIfNoCase Request_URI ^/example\.pdf$ MODSEC_ENABLE=Off
</IfModule>
Here's more information on Dreamhost's use of mod_security
and writing custom .htaccess rules.