@Muetze I added the header to the download similar to the Laravel document. Of course, he did not add content-length in the document. Since it does not be added, I tried to add it myself. But in any case, it is still not added to the output.
Is this content-length removed from the header elsewhere?
@Muetze I found the problem. There is only a problem on the server, the reason for which is the addition of:
content-encoding: gzip
I looked at the server settings, there is such a rule:
# Don't compress images and other uncompressible content
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|rar|zip|exe|flv|swf|mov|wma|mp3|mp4|avi|mp?g)$ no-gzip dont-vary
but this rule doesn't affect on laravel download URL. I change my url like this:
Finally, I added php to the no-gzip list and the problem went away. Apparently, Apache does not recognize these as files at all, and PHP recognizes them. And of course, with what I did, gzip is no longer applied to any of the pages that are php, which is bad.
I tried to apply this rule only to a specific url that starts with download, But whatever I tried, it didn't work, it was either completely disabled or it worked on all urls.