CloudFlare Currently Breaking PDF files

#1

Currently, I’m seeing an issue where Cloudflare replaces the contents of PDF files on my server with 34-character code.
Example: https://fccid.io/pdf.php?id=2303213
Trying to load this file in any browser will result in a code similar to:
ec6a90e2-397b-4c80-b10c-273def9a2ae6
The code will always be different despite the returned header of:
CF-Cache-Status: HIT
Attempting to download the file via curl or wget returns the proper file.

The end of my PHP script creating the file appears as so:
header("Reported-Size: ".strlen($data));
header("Content-length: ".strlen($data));
print $data;

You can see the Reported-Size header is much larger than the content of the document (as the real content is lost somewhere in cloudflare)

#2

The format of the response has changed, similarly showing some strange response from cloudflare’s internal system.

<!doctype html><embed style='position:absolute; left: 0; top: 0;'width=‘100%’ height=‘100%’ src=‘about:blank’ type=‘text/html’ internalid=‘0DAA5DBED92D088397EFE89379739B17’>

#3

Hi @user1971 ,

Could you provide a link to any of these .pdf files?

#4

Here’s a direct link to a PDF file which loads fine in chrome, but will give the strange 36 byte code when you view-source:https://fccid.io/hello-world.pdf

#5

What mechanism could cloudflare possibly employ to determine the user is using the view-source panel?!?

#6

Seems to work for me. Try a different browser or check your browser settings.

#7

Just checked it on Chrome and got the same output as you. It would look like it is Chrome specific, probably part of the implementation.