I’ve got Drupal 7.x website and after setting-up Cloudflare there is a problem on mobile devices (tested on iPhone, but same problem is on Android devices; desktop browsers somehow manage this problem and can download PDF properly even without Content-Length) with PDF files served via Drupal aliases. After “Pause” on CF everything works fine, so it looks like this issue is CF related, not Drupal.
For some reason CF cuts out “Content-Length” for these URLs.
…but bypassing CF and going directly to server’s IP returns proper header: > curl -I --resolve mahajana.net:443:91.121.209.206 https://mahajana.net/teksty/zazen-kodo-sawaki.pdf
I’ve tried to turnoff all CF features and also set-up some page rules, but no result, same problem: *mahajana.net/teksty/*
Disable Security, Disable Zaraz, Disable Apps, Disable Performance *mahajana.net/*
Cache Level: Bypass
Doesn’t that show that in-flight compression by Cloudflare is the reason? If the origin delivers gzip, and then Cloudflare delivers gzip to you, then the file size is known and can be given. If the origin delivers gzip but the browser asks for brotli, or non-compressed, then the change by on-the-fly compression/decompression means the file size is unknown at the time the headers are produced.