Safari通过服务工作者请求来阻止Apache

时间:2018-04-23 13:57:31

标签: javascript safari service-worker

在我的apache日志中,我可以看到Safari在iOS和Mac上的最新版本中,有时会在一秒钟内向服务工作者.js文件发送多达40-60个请求(!)的Apache。

在这里查看zgrep serviceWorker /var/log/apache/access.log*|uniq -c|sort -n|less命令的输出:

 38 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:09:15:28 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 38 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:08:55:42 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 39 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:20:00:29 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 39 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:13:59:21 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 39 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:14:00:51 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 39 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:11:18 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 39 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:12:35 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 39 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:23:28 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 39 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:31:37 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 39 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:20:31:37 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 39 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:20:31:43 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 39 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:17:12 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 40 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:20:00:43 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 40 access.log.13.gz:my.domain:443 123.456.789.XXX - - [10/Apr/2018:12:23:28 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:21:29 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:47:28 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:48:35 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:09:30:22 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:12:19:41 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:09:11:30 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:09:17:35 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 40 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:09:19:52 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 40 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:44:10 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 40 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:53:44 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 40 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:13:08:40 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 41 access.log.13.gz:my.domain:443 123.456.789.XXX - - [10/Apr/2018:10:37:39 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 41 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:07:24:25 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 41 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:28:45 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 41 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:09:09:34 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 42 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:20:35:13 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 42 access.log.13.gz:my.domain:443 123.456.789.XXX - - [10/Apr/2018:11:09:19 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 42 access.log.13.gz:my.domain:443 123.456.789.XXX - - [10/Apr/2018:12:21:53 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 42 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:23:50 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 42 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:09:16:33 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 42 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:21:19:46 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 43 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:16:22:44 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 43 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:21:29:46 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 44 access.log.11.gz:my.domain:443 123.456.789.XXX - - [12/Apr/2018:22:15:36 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 45 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:10:28:15 +020A0] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 45 access.log.8.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:06:08:30 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 45 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:43:06 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 45 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:16:31:05 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 47 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:10:47 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 48 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:08:11:08 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 49 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:09:30:29 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 49 access.log.11.gz:my.domain:443 123.456.789.XXX - - [12/Apr/2018:13:40:14 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 49 access.log.11.gz:my.domain:443 123.456.789.XXX - - [12/Apr/2018:22:11:47 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 49 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:12:22:27 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 49 access.log.14.gz:my.domain:443 123.456.789.XXX - - [09/Apr/2018:07:47:58 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 49 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:09:04:53 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 50 access.log.7.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:12:01:50 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 50 access.log.8.gz:my.domain:443 123.456.789.XXX - - [16/Apr/2018:06:08:31 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 50 access.log.8.gz:my.domain:443 123.456.789.XXX - - [15/Apr/2018:09:19:38 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 50 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:39:35 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 50 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:41:21 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 50 access.log.9.gz:my.domain:443 123.456.789.XXX - - [14/Apr/2018:08:54:14 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 51 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:20:45:56 +0200] "GET /serviceWorker.js HTTP/2.0" 304 0 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
 61 access.log.10.gz:my.domain:443 123.456.789.XXX - - [13/Apr/2018:20:45:57 +0200] "GET /serviceWorker.js HTTP/2.0" 403 315 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"

我已经禁用了HTTP2并稍微修改了serviceWorker.js文件,它已经平了一点,但每隔一段时间我们仍会连续看到5-15个请求,就像今天一样:

 10 my.domain:443 123.456.789.XXX - - [23/Apr/2018:12:51:36 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 10 my.domain:443 123.456.789.XXX - - [23/Apr/2018:14:48:48 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 10 my.domain:443 123.456.789.XXX - - [23/Apr/2018:07:32:03 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 10 my.domain:443 123.456.789.XXX - - [23/Apr/2018:11:27:31 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:11:04:22 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:12:58:13 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:14:37:00 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:10:43:52 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:08:12:10 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:07:16:13 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:13:41:09 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:10:16:59 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 11 my.domain:443 123.456.789.XXX - - [23/Apr/2018:11:42:57 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 12 my.domain:443 123.456.789.XXX - - [23/Apr/2018:11:28:44 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 12 my.domain:443 123.456.789.XXX - - [23/Apr/2018:13:41:10 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 12 my.domain:443 123.456.789.XXX - - [23/Apr/2018:14:48:47 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 13 my.domain:443 123.456.789.XXX - - [23/Apr/2018:09:22:44 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 13 my.domain:443 123.456.789.XXX - - [23/Apr/2018:14:21:53 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 15 my.domain:443 123.456.789.XXX - - [23/Apr/2018:13:43:13 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 16 my.domain:443 123.456.789.XXX - - [23/Apr/2018:12:37:54 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 17 my.domain:443 123.456.789.XXX - - [23/Apr/2018:08:12:11 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 17 my.domain:443 123.456.789.XXX - - [23/Apr/2018:14:27:10 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 17 my.domain:443 123.456.789.XXX - - [23/Apr/2018:11:37:42 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"
 19 my.domain:443 123.456.789.XXX - - [23/Apr/2018:13:43:14 +0200] "GET /serviceWorker.js HTTP/1.1" 200 479 "https://my.domain/serviceWorker.js" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1"

对serviceWorker.js的请求的返回标头是:

200 OK
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Connection: close
Date: Mon, 23 Apr 2018 13:49:32 GMT
Pragma: no-cache
Accept-Ranges: bytes
Server: Apache/2.4.25 (Debian)
Content-Length: 58
Content-Type: application/javascript
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Fri, 20 Apr 2018 12:36:28 GMT
Client-Date: Mon, 23 Apr 2018 13:49:32 GMT
Client-Peer: XXX.XXX.XXX.XXX:443
Client-Response-Num: 1

serviceWorker.js的当前内容:

self.addEventListener('fetch', function() {
    return;
})

我们如何注册:

  if ('serviceWorker' in navigator) {
      window.addEventListener('load', function() {
          navigator.serviceWorker.register('/serviceWorker.js', {
              scope: '/mobile'
          }).catch((error) => {
              // eslint-disable-next-line no-console
              console.log("Service worker registration failed: ", error);
          });
      });
  }

为什么会发生这种情况?并且只有最新的Safari?

0 个答案:

没有答案