February 10, 2024 6:09 AM   Subscribe

Why isn't my portfolio PDF displaying on my website?

I've recently run into an issue with the portfolio PDF on my website not displaying, and I cannot figure out why.

If you click on the link on the front page of my site, you should get my portfolio PDF. At least, you did until recently. Now, all you get is a blank page. There's no File Not Found error. The browser sees that a file is there, but nothing is displaying.

All other normal image files (jpg, png, etc.) display as expected. Only the PDF is having this problem. The PDF resides in the same directory with the other images, so it can't be a filepath issue. I uploaded another, different PDF to what would happen, and it, too, was unviewable. I uploaded a fresh copy of the portfolio PDF, but nothing changed. For some reason, PDFs have become unviewable.

An odd development I noted is that, when you right-click on the PDF link and select to download the PDF, you end up with an empty file. WTF?

My site is, admittedly, a pretty basic, barebones, set-it-and-forget-it, old-school thing. Has webhosting changed so much that simply clicking on a PDF link no longer works correctly? Do I now need to wrap the simple PDF link in some additional codesalad to make it display in a browser?

I should note that I have been with this host (MochaHost) for several years, and have never had this issue until recently. I started a support ticket but haven't received a replay as yet, so I thought I would see if any MeFites would have a suggestion.

posted by Thorzdad to Technology (9 answers total) 1 user marked this as a favorite
Best answer: Looking at the HTTP headers, your host's web server is sending an empty (zero-byte) response, with the Content-Type header set to text/html instead of application/pdf.

Seems like it is misconfigured. Something for the host to fix.
posted by Klipspringer at 6:25 AM on February 10

Response by poster: Thank you, Klipspringer. Just to be clear, that is not something I can change on my own, via whatever site tools provided to me by the host?
posted by Thorzdad at 6:35 AM on February 10

Best answer: It looks like most MochaHost accounts have cPanel available. So you could start delving into Advanced > MIME types. You want ".pdf" files to be served with MIME type "application/pdf".

But servers should do this correctly out of the box without any additional configuration. If it used to and now doesn't, this points to a problem on Mocha's end. And sorting the MIME type issue may or may not resolve the zero-length issue.

So I would leave it to them unless you are in immediate need of a workaround.
posted by Klipspringer at 7:00 AM on February 10 [1 favorite]

Response by poster: MIME type is correct in cPanel. So, yeah, seems like this is Mocha's snafu to fix, I guess.
Thanks, again, Klipspringer.
posted by Thorzdad at 7:21 AM on February 10 [1 favorite]

Best answer: Suggest to them that they just restart the server.
posted by intermod at 7:30 AM on February 10 [2 favorites]

Response by poster: Heh. I've worked with devs, and know all too well how much they just loooove mere users making suggestions. Maybe as a last resort, LOL.

I note that someone has uploaded a test PDF to my site, which also does not load. So, someone appears to be working on it.
posted by Thorzdad at 8:00 AM on February 10

I see it noiw
posted by kathrynm at 3:01 PM on February 10

Yuuup, working now.
posted by intermod at 9:07 PM on February 10

Response by poster: Yep. It's back up.

According to whomever was working on this on Mocha's end, there was (somehow) an htaccess rule in-place blocking pdf viewing. They fixed it. The question of why this was in-place wasn't addressed, though the response in the ticket seems to infer that I set it up that way, which I absolutely did not.
posted by Thorzdad at 9:20 AM on February 12 [1 favorite]

« Older No bump, just grind   |   Best sites to look up computer value, sell... Newer »

You are not logged in, either login or create an account to post comments