We have been fighting this for more than a week:
- When CloudFlare is OFF - downloadable products work fine
- When CloudFlare is ON - the download starts and reaches 100%, the speed drops down to 0 and the download gets corrupt with an "unknown network error" message
There is a Page rule set in CF which says not to cache files which are on
domain.com/download* but that doesn't help. Even in CF "developer mode" the problem exists. Only when the cloud is paused and the server is accessed directly - things work fine.
The hosting provider suspected the reason was gzip encoding. So I made a simple test:
- Create a directory domain.com/download-test
- Add an .htaccess file to it with contents:
AddType binary/octet-stream .bin
- Generated a simple 10mb file in the directory:
dd if=/dev/urandom of=test.bin bs=1MB count=10
10+0 records in 10+0 records out 10000000 bytes (10 MB) copied, 1.45406 s, 6.9 MB/s
- Downloaded the file with Cloudflare = ON without any problem and I see content-encoding:gzip in the HTTP headers. So the problem is definitely not gzip.
The hosting provider says they can't do anything as everything works directly to their server. Fair enough.
CloudFlare says "create a subdomain and serve downloads from there". But this is not possible because A) The store frontend runs entirely on HTTPS and our SSL certificate is only for domain.com and www.domain.com B) Magento has no option for serving downlodable products from a subdomain.
Desperately looking for a fix.
NOTE: Our downloadable products are not uploaded but linked to an external host (in case that matters).