1 of 29

Chromeが擬似的に返す謎の307リダイレクト

HTTPS First Modeとは

市川@cakephper

PHPerKaigi 2024

2 of 29

自己紹介

  • 市川 @cakephper
  • 福岡在住 / PHPカンファレンス福岡

3 of 29

VAddy PHPカンファレンス全部スポンサーする

  • PHPカンファレンス北海道 2024 ゴールド
  • PHPカンファレンス関西 2024 シルバー
  • PHPerKaigi 2024 プラチナ
  • PHPカンファレンス小田原 2024 松
  • PHPカンファレンス香川
  • PHPカンファレンス福岡 2024 シルバー

4 of 29

HSTS(HTTP Strict Transport Security)

  • HTTPSを強制
  • サイト管理者が設定

5 of 29

HSTS指定方法

  • レスポンスヘッダで指定
  • HSTS Preload List
  • .dev .appのTLD

6 of 29

HSTS

サイト管理者が

HTTPSで接続してほしい世界

7 of 29

わかる!

8 of 29

Chromeが勝手に

HTTPSで強制接続する世界

9 of 29

10 of 29

非HSTSサイトなのに

11 of 29

??????

12 of 29

目次

  • HTTPS First Mode/HTTPS Upgrade
  • 307リダイレクト
  • ポート指定の307

13 of 29

HSTSの問題点

  • サイト側の設定に依存
  • 初回のhttpアクセスは発生する

14 of 29

HTTPS First Mode

HTTPS Upgrade

15 of 29

HTTPS First Mode/HTTPS Upgrade

Chrome「初手HTTPSで繋いでみようぜ」

Chrome「HSTSとか関係なく」

Chrome「ダメならフォールバックすればおk」

16 of 29

HTTPS First Mode/HTTPS Upgrade

2023年8月にデフォルトオンにしたいと表明

https://blog.chromium.org/2023/08/towards-https-by-default.html

17 of 29

HTTPS First Mode/HTTPS Upgrade

2023年10月

Chrome 「やっておきました!」

18 of 29

世界のスピード感!

19 of 29

HTTPS Upgradeの動作

http://…

HTTP/1.1 307 Temporary Redirect

Location: https://example.com/

Non-Authoritative-Reason: HttpsUpgrades

Content-Length: 0

20 of 29

HTTPS Upgradeの動作

https://…

httpsでアクセス

21 of 29

HTTPS Upgradeの動作(フォールバック)

http://…

HTTP/1.1 307 Temporary Redirect

Location: http://example.com/

Non-Authoritative-Reason: HttpsUpgrades

Content-Length: 0

22 of 29

307はChromeの中だけの世界

23 of 29

HTTPS Upgradeのフォールバック

httpsポートが閉じている

証明書エラー

レスポンスが404

レスポンス受信まで3秒以上かかる

24 of 29

HTTPS Upgradeでより安全な世界に!

想定外の動作となるケースがある

25 of 29

ポート指定の場合のHTTPS Upgrade

http://example.com:8000

https://example.com:8000

同一ポートにリダイレクト!

26 of 29

ご清聴ありがとうございました

27 of 29

始まりは突然に

2023年10月1日

VAddy Chrome/Edge拡張をリリース

10月16日に拡張が壊れた

28 of 29

資料

29 of 29

メモ

HSTSのヘッダ

 Strict-Transport-Security: max-age=<expire-time>

Preload Listは仕様書で定義されていないため注意

RFC https://www.rfc-editor.org/rfc/rfc6797#section-6.1