PDF Files Hosted On Dreamhost Not Opening In Chrome - pdf

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.

Related

How to enable Notes to uncompress gzip files when doing preview in webbrowser

I have a bunch of gzipped javascript files that are added to resources\files in a Notesdatabase. when I view these files on the server, Domino seem to unzip them and show them correct in the webbrowser. but when I view them using preview in webbrowser the files are not unzipped.
is there any notes.ini pararmeter I can use on the client to make this work also when doing preview in webbrowser.
There are .ini settings on the server that govern how gzip files are handled but there aren't any I'm aware of for the client/designer. To my knowledge, the only objects you can preview in a web browser from designer are forms, views, folders, xpages and pages. Resources can't be previewed. Can you be more specific about what actions you're taking?
Note: this should have been a comment but my karma isn't high enough yet to allow for that. Please be kind before down voting.

click pdf link in web, how to preview instead of download?

I have my resume linked in my home page.
But I found when I host the pdf file on two different storage server, the default behavior when click on the link differs: one directly download the pdf file bug the other preview in a new tab.
the two links are as below:
http://data-10045577.file.myqcloud.com/doc/Zhao.Kai_ShanghaiUniv.pdf
http://7xocv2.dl1.z0.glb.clouddn.com/doc/Zhao.Kai_ShanghaiUniv.pdf
I have tested on firefox chrome IE that this is not a browser issue.
For some price issue I have to switch to the storage server of which the default behavior is downloading pdf file.
what settings should I have so that click the pdf link then preview instead of downlod?
Additionally, the storage server provide a configure option that can set the "http header", I know little about the web, so can setting a header work, if so, how to ?
I googled it and it seems the content-disposition argument in http header account for this. But I add content-disposition='inline', doesn't help.
if not the browser's issue, then the download one is added programmatically with headers, and the preview one is just putting your file in that folder on the server

Preventing direct access to files in IIS 7

I have a PHP application running on a Micrisoft IIS 7 server. The application shows PDF files on an iFrame, which contains user's sensitive data that I wouldn't like to be directly accessed by anyone that knows the file address.
So basically, I'm looking for a way to protect files from direct browser access or download, but still be able to show it on the application's iFrame.
I made some research with Rewrite rules, but since the "HTTP_REFERER" of an iFrame is empty, I couldn't find a good solution
Any suggestions for this?
Thanks in advance
Without seeing any of your code, or how your application works, I can only give suggestions based on how I think your app works.
Rather than showing the files themselves, with links directly to those files, you should consider changing your application so that the PHP reads in the directory, displays the file names (however you want them to appear), with links that go to a download.php page. The download page (after checking whether the user has permission to download the file) then loads the file into memory and serves it out as a response (with appropriate Content-Disposition and Content-Type headers).
Since your PHP application can read files directly within the web directory, you can set up rewrite rules to prevent accessing those files from the web; that way, the files can only be accessed by the PHP application, which doesn't rely on rewrite rules to access the drive.
This is how places like Source Forge can display an advertisement with a countdown that your file download will begin in 5 seconds.

Why are SharePoint pdfs no longer opening from within the browser?

I have upgraded a SharePoint, excatly same code, but now links to pdfs always prompt to save and dont open from within the browser (which they do on the old server)
old server is named: localintranet
new server is my local machine: myserver:3200 (yes its on port 3200)
Any ideas?
I did try adding my server to the list of local intranet machines in internet explorer to no avail.
I have tried both href=file.pdf target=_blank and onclick=window.open('file.pdf');return false; in the anchor tag
driving me nuts!
Try to add
AddType application/pdf .pdf
line into your .htaccess file in the http root folder of your web server.
Two things:
to be sure check:
Adobe Reader.
Choose Edit > Preferences.
Select Internet in the list on the left.
Display PDF in Browser should be OK.
probably server sends header for .pdf to download it, instead open inline?
Header set Content-Disposition inline
You gotta love microsoft
http://blog.brainlitter.com/archive/2010/05/19/sharepoint-2010-treats-pdf-and-other-file-types-as-insecure.aspx

Apache giving pages as downloads rather than displaying them

I just installed MediaWiki on a website and I am having some problems.
Whenever I go to "www.something.com/wikidir" the server gives me the PHP index file as an unnamed download instead of displaying it.
However, if I go to "www.something.com/wikidir/index.php" everything works as expected.
I'm not familiar with Apache and was wondering if someone could tell me how to fix this or point me in the right direction?
I'm using a LAMP stack and Mediawiki 1.7.1 (old I know).
In my .htacces file I have:
AddType application/x-httpd-php5 .php
Sounds like Apache (or PHP?) is serving the page as an application/octet-stream. You can check this by looking at the response headers on the non-index.php page. Firefox can do this using the Web Developer Toolbar > Information > View Response Headers. Look for "Content-Type"
Or, Does the non-index.php link work in IE? Does it go straight to download in Firefox (or another browser)? If the answer is yes, that's the problem.
How to fix it is more complex because there could be a bunch of different things that are causing this. My guess is that's it's an Apache config issue.
Edit
Check your .htaccess file. Make sure it's readable by Apache. I bet that's the issue.