CloudFlare Currently Breaking PDF files

Currently, I’m seeing an issue where Cloudflare replaces the contents of PDF files on my server with 34-character code.
Trying to load this file in any browser will result in a code similar to:
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)

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’>

Hi @user1971 ,

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

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:

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

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

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.

This topic was automatically closed after 14 days. New replies are no longer allowed.