2

I am experiencing an issue in Safari only where sites loaded over http/2 on our Apache 2.4 servers will intermittently (every 3-5 requests) fail to load certain resources. The pages always seem to load, but the JS, CSS, and images seem to fail. I will see the error Failed to load resource: The network connection was lost. in the console and occasionally an Unexpected end of script error. If I load the JS directly, every 3-5 requests only about 3/5 of the file will load and no error will be thrown. If I disable http/2, everything works as expected. All of the sites are running with Let's Encrypt certs.

Is there a solution to this issue? As an alternative, is it possible to use BrowserMatch to disable http2 for just Safari? While that isn't the ideal solution, it is preferable to sites being unable to load half their resources in Safari. I've never had to use BrowserMatch before, though, and I am unsure of what the syntax would be.

Config info:

Debian version: 9.6
Server version: Apache/2.4.25 (Debian)
Server built:   2018-11-03T18:46:19
Protocols h2 h2c http/1.1
PHP7.0 and PHP7.2 running with FPM

Loaded Modules:

core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
filter_module (shared)
http2_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
vhost_alias_module (shared)

Example of Failed Network Request:

Summary
URL: https://www.example.com/wp-content/themes/example/app/scripts.min.js
Status: 200
Source: Network
Address: 111.111.111.111:443

Request
:method: GET
:scheme: https
:authority: www.example.com
:path: /wp-content/themes/example/app/scripts.min.js
Cookie: _ga=GA1.2.693564551.1543614967; _gid=GA1.2.1931614765.1543937949; _gat_gtag_UA_127993364_1=1
Accept: */*
Cache-Control: max-age=0
Accept-Language: en-us
If-None-Match: "45da3-57c343a615009-gzip"
Host: www.tahv.org
If-Modified-Since: Tue, 04 Dec 2018 15:50:43 GMT
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15
Referer: https://www.example.com/
Accept-Encoding: br, gzip, deflate
Connection: keep-alive

Response
:status: 200
Content-Type: application/javascript
Expires: Fri, 07 Dec 2018 16:31:14 GMT
Last-Modified: Tue, 04 Dec 2018 15:50:43 GMT
Vary: Accept-Encoding
Accept-Ranges: bytes
Date: Tue, 04 Dec 2018 16:31:14 GMT
Content-Encoding: gzip
Cache-Control: max-age=259200
ETag: "45da3-57c343a615009-gzip"
Server: Apache/2.4.25 (Debian)
Josh
  • 143
  • 2
  • 11
  • Might be worth checking if you have a bad HTTP header. The browsers are a bit more strict on this than they were under HTTP/1.1. Could be a subsequent request is killing the connection, preventing the JS download which is already in flight from completing. Use Chrome to check this as it has better HTTP/2 logging than Safari: https://www.michalspacek.com/chrome-err_spdy_protocol_error-and-an-invalid-http-header – Barry Pollard Dec 05 '18 at 22:46
  • @BarryPollard Nothing seems out of place to me in either Safari or Chrome (or the Chrome event log). One thing I did notice is that when it fails, the request size is about half of what it is when it succeeds (45B vs 95B) and when it fails, Safari reports it took "-197.8ms" to download (50.1ms on success). There definitely seems to be something wrong with Safari here. – Josh Dec 06 '18 at 14:46
  • 2
    This is a known bug in Debian's Apache package. Been known since Nov 2018. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915103 – Manu Feb 01 '19 at 05:31
  • @ManuelRiel Thank you for that link. We were struggling to find anything at all on it. I will follow that issue and hopefully this gets resolved – Josh Feb 01 '19 at 14:48

0 Answers0