brew update
するとよくこんな感じのエラーがでる。
$ brew update
==> Updating Homebrew...
Error: Failed to download https://formulae.brew.sh/api/cask.jws.json!
Failed to download https://formulae.brew.sh/api/formula_tap_migrations.jws.json!
$
でない時もあるのであまり気にしてなかったけど、多いのでちゃんと調べてみる。
DNSリゾルバが自前運用なので真っ先に疑うが、名前解決は問題なさそう。pingも通る。
$ dig formulae.brew.sh
; <<>> DiG 9.10.6 <<>> formulae.brew.sh
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18866
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;formulae.brew.sh. IN A
;; ANSWER SECTION:
formulae.brew.sh. 2586 IN CNAME homebrew.github.io.
homebrew.github.io. 3600 IN A 185.199.109.153
homebrew.github.io. 3600 IN A 185.199.110.153
homebrew.github.io. 3600 IN A 185.199.111.153
homebrew.github.io. 3600 IN A 185.199.108.153
;; Query time: 62 msec
;; SERVER: *.*.*.*#53(*.*.*.*)
;; WHEN: Sun Jul 20 19:49:31 JST 2025
;; MSG SIZE rcvd: 141
$ ping -c 1 formulae.brew.sh
PING homebrew.github.io (185.199.111.153): 56 data bytes
64 bytes from 185.199.111.153: icmp_seq=0 ttl=52 time=5.644 ms
--- homebrew.github.io ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.644/5.644/5.644/0.000 ms
$
curlで取得しようとするとエラー。
$ curl -v https://formulae.brew.sh/api/cask.jws.json
* Host formulae.brew.sh:443 was resolved.
* IPv6: 2606:50c0:8000::153, 2606:50c0:8002::153, 2606:50c0:8001::153, 2606:50c0:8003::153
* IPv4: 185.199.110.153, 185.199.111.153, 185.199.109.153, 185.199.108.153
* Trying [2606:50c0:8000::153]:443...
* Connected to formulae.brew.sh (2606:50c0:8000::153) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/cert.pem
* CApath: none
* Recv failure: Connection reset by peer
* LibreSSL/3.3.6: error:02FFF036:system library:func(4095):Connection reset by peer
* Closing connection
curl: (35) Recv failure: Connection reset by peer
$
どうもIPv6で接続しようとするとTLSのClientHelloでRSTされるらしい。
一応IPv6の名前解決・pingに問題がないことを確認する。
$ dig formulae.brew.sh aaaa
; <<>> DiG 9.10.6 <<>> formulae.brew.sh aaaa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43714
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;formulae.brew.sh. IN AAAA
;; ANSWER SECTION:
formulae.brew.sh. 2236 IN CNAME homebrew.github.io.
homebrew.github.io. 3600 IN AAAA 2606:50c0:8003::153
homebrew.github.io. 3600 IN AAAA 2606:50c0:8000::153
homebrew.github.io. 3600 IN AAAA 2606:50c0:8001::153
homebrew.github.io. 3600 IN AAAA 2606:50c0:8002::153
;; Query time: 6 msec
;; SERVER: *.*.*.*#53(*.*.*.*)
;; WHEN: Sun Jul 20 19:55:21 JST 2025
;; MSG SIZE rcvd: 189
$ ping6 -c 1 2606:50c0:8000::153
PING6(56=40+8+8 bytes) *:*:*:*:*:*:*:* --> 2606:50c0:8000::153
16 bytes from 2606:50c0:8000::153, icmp_seq=0 hlim=54 time=6.018 ms
--- 2606:50c0:8000::153 ping6 statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 6.018/6.018/6.018/0.000 ms
$
試しにIPv4でcurlしてみると問題なく通る。
$ curl -4 -I -sS https://formulae.brew.sh/api/cask.jws.json | head -n 1
HTTP/2 200
$
ついでにIPv6で通らないことを確認...しようとしたら通ってしまった。
$ curl -6 -I -sS https://formulae.brew.sh/api/cask.jws.json | head -n 1
HTTP/2 200
$
どうもIPv6の時に通ったり通らなかったりする模様。
原因を特定したかったがサーバからRSTが返されるのでどう調べたらよいかわからず...
雑に調べた範囲では証明書の期限切れに関する記事が見つかったが、確認しても当てはまらなかった。
VPN接続などでIPv4を強制すれば暫定的に対応できることがわかっただけよしとする。