0

I am attempting to configure an Apache 2.4.25 (Debian 9.7) server to serve files via HTTP/2.

All HTML, CSS, JS and image files are being correctly served.

However, I am facing difficulties with larger files, for example a ZIP file that is 58 MB (60639199 b):

https://www.scan2docx.com/img/document_scanner_samples.zip

Downloading this file via HTTP/1.1 works exactly as expected. Here is an excerpt out of the Apache access log:

x.x.x.x - - [08/Feb/2019:08:11:05 +0100] "GET /img/document_scanner_samples.zip HTTP/1.1" 200 60752807 "-" "Wget/1.18 (linux-gnu)"

However, when downloading via HTTP/2, the following error is returned in Chrome:

Failed - network error

And in FireFox:

Failed

Here is an excerpt out of the Apache access log:

x.x.x.x - - [08/Feb/2019:08:02:08 +0100] "GET /img/document_scanner_samples.zip HTTP/2.0" 200 60639199 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"    

The Apache error logs do not contain any information from around the same time.

By clicking on the "resume" button in the web browser multiple times, it is possible to eventually download all 58 MB of the ZIP file.

It would seem that the ZIP file is being downloaded in chunks of almost 6 MB each time "resume" is clicked. Here are the file sizes from Chrome:

"Unconfirmed 149963.crdownload"  6282112 b
"Unconfirmed 867419.crdownload" 12564224 b
"Unconfirmed 121076.crdownload" 18846336 b
"Unconfirmed 499937.crdownload" 25128448 b
"Unconfirmed 249798.crdownload" 31410560 b
"Unconfirmed 631305.crdownload" 37692672 b 
"Unconfirmed 871992.crdownload" 43974784 b

Could anyone offer an explanation of what is going on here?

And make some suggestions on how I can fix the problem?


UPDATE: Tests results using curl 7.64.0.

Using curl with HTTP2 support, I could download the ZIP files via HTTP/1.1 and HTTP2 correctly.

I used the following commands:

/usr/local/bin/curl -vs --http1.1 -o via_http_1_1.zip https://www.scan2docx.com/img/document_scanner_samples.zip &> /dev/stdout | tee -a via_http_1_1.txt

/usr/local/bin/curl -vs --http2   -o via_http_2.zip   https://www.scan2docx.com/img/document_scanner_samples.zip &> /dev/stdout | tee -a via_http_2.txt

The entries in the Apache access.log are as follows:

x.x.x.x - - [08/Feb/2019:12:37:24 +0100] "GET /img/document_scanner_samples.zip HTTP/1.1" 200 60752588 "-" "curl/7.64.0"
x.x.x.x - - [08/Feb/2019:12:37:37 +0100] "GET /img/document_scanner_samples.zip HTTP/2.0" 200 60639199 "-" "curl/7.64.0"

The downloaded ZIP files are as follows:

-rw-r--r--  1 x x 60639199 Feb  8 12:37 via_http_1_1.zip
-rw-r--r--  1 x x 60639199 Feb  8 12:37 via_http_2.zip

HTTP/1.1 log file: https://www.scan2docx.com/img/via_http_1_1.txt

HTTP/2 log file: https://www.scan2docx.com/img/via_http_2.txt

However, in web browsers, all operating systems, the downloads continue to fail.

What gives?

Jonathan Maron
  • 121
  • 1
  • 1
  • 5
  • This sounds familiar. I assume no scripting language is involved (ie PHP) - what sort of timeout settings are configured? (Gut says it isn't size related but the amount of time it takes to serve: try throttling browser to see if the resulting size drops massively). – Richy B. Feb 08 '19 at 08:34
  • First of all, thank you very much for your suggestion. I throttled the download speed in Chrome to "Slow 3G", cleared the cache and restarted the download: https://www.scan2docx.com/img/000001.png. After a few minutes (previously seconds), the download failed: https://www.scan2docx.com/img/000002.png. The downloaded file was a very similar size to previously ("Unconfirmed 705588.crdownload" 6291456 b). – Jonathan Maron Feb 08 '19 at 09:14
  • To your questions: 1) PHP 7.1.26 is installed on the server as FPM/FastCGI. However, as far as I know, PHP is not involved in the above download whatsoever (only *.php and *.phtml files are parsed by PHP). Could PHP be interfering in the ZIP download nevertheless? 2) The Timeout directive is at the default value in "/etc/apache2/apache2.conf" ("Timeout 300"). Even in the throttled browser state, the download failed well before the 5 minute mark. – Jonathan Maron Feb 08 '19 at 09:15
  • I'm not too sure now myself, it's definitely a HTTP2 issue thought `# ensure we have curl with http2 brew install curl-openssl # test over http1.1 - 57.8M downloaded /usr/local/opt/curl-openssl/bin/curl -v --http1.1 -o /dev/null https://www.scan2docx.com/img/document_scanner_samples.zip # test over http2 - 4104k downloaded /usr/local/opt/curl-openssl/bin/curl -v --http2 -o /dev/null https://www.scan2docx.com/img/document_scanner_samples.zip` – Richy B. Feb 08 '19 at 11:06
  • Interesting: Using curl 7.64.0 with HTTP/2 support, I could download the ZIP file correctly. I updated the original post to include these findings. – Jonathan Maron Feb 08 '19 at 11:53
  • Suggest you try the latest version of Apache and see if same thing happens. If so raise an issue here: https://github.com/icing/mod_h2/issues as the mod_http2 (formerly called mod_h2) author is very responsive to things like this. – Barry Pollard Feb 08 '19 at 21:10

0 Answers0