[17] [DFN[eTLD+1]], [DFN[[RUBYB[サイト][site]]]] 
は、同一の管理主体の管理下にあると思われる[[ドメイン名]]空間の単位です。
[[Web]] においては[[起源]]の次に大きな[[セキュリティー]]その他の制御上の重要な構造として扱われています。

* 仕様書

[REFS[
- [2] [CITE@en[Storage Standard]] ([TIME[2015-11-18 18:41:19 +09:00]] 版) <https://storage.spec.whatwg.org/#site>
]REFS]

* 呼称

** eTLD+1

[31] 
従来 ([[平成時代]]後期頃まで) [[Web]] では、
[[eTLD]] に[[サブドメイン]]1階層分を足したもの、というくらいの意味で
[[eTLD+1]]
と呼ばれるのが一般的でした。

;; [32] ただし、概念として安定していなかったこともあり、
他のドメイン名系の用語や、説明的な表現も使われていました。


** サイト

[33] 
[[平成時代]]後期頃、 [[eTLD+1]] の概念を直接的に表現する[[プロトコル要素]]がいよいよ必要となるとそれを表す用語が検討されました。
結果選ばれたのが[[サイト]] ([[site]]) でした。

[34] 
一般語としての[[サイト]] ([[Webサイト]]) は[[90年代]]からよく使われていました。
(おそらく[[Web]]以前からあった[[ネットワーク]]分野の語からの派生でしょう。)
[[eTLD+1]] と[[Webサイト]]は必ずしも一致しませんが、
おおよそ対応関係にあるということで選ばれたのでしょう。

[29] かつて ([[90年代]]末頃から) 
[[IE]] は [CODE[Site-Enter:]]、[CODE[Site-Exit:]]
という[[HTTPヘッダー]]を実装していました。

;; [30] 現在の「サイト」の定義とこれらの[[ヘッダー]]の挙動は違うと思われます。

[35] 
[[サイト]]は、[[ドメイン名]]が関係しない [CODE[data:]] や
[CODE[about:blank]]
のような [[URL]]
に対しても定義されます。

** ドメイン名系の用語

[13] [[public suffix]] に一階層加えた[[ドメイン]]を、
[DFN[naked domain]]、[DFN[apex domain]]、[DFN[zone apex]]、[DFN[root domain]]
などと呼ぶことがあります。

[EG[
[14] [CODE[example.com]] は [[naked domain]] です。 [CODE[www.example.com]] は
[[naked domain]] ではありません。
]EG]

;; [15] [[DNS]] では [[TLD]] より上位の名前の無い階層 ([CODE[.]]) のことを [[root domain]]
と呼んでおり、 [[naked domain]] のことを [[root domain]] と呼ぶのは適切ではありません。

[16] 「[CODE[CNAME]] を使えない」といった話題でよく使われる用語です。

[74] 
[[DNS]] の設定では[[サブドメイン]]ではなくこの[[ドメイン]]を表すために
[DFN[[CODE[@]]]]
が[[サブドメイン]] ([[ホスト名][特殊ホスト名]]) であるかのように使われることがよくあります。


* 意味

;; [6] [[PSL]] も参照。

* 比較

[37] 
[[サイト]]の[[比較]] ([[等価性]])
は、
[[URL scheme]] を考慮する[[同じサイト]]と、
考慮しない
[[schemeなしで同じサイト]]の2種類があります。



[38] 
[[起源]] [VAR[A]]
と[[起源]] [VAR[B]]
が[DFN[[RUBYB[schemeなしで[RUBY[同][おな]]じサイト][schemelessley same site]]]]であるか否かは、
次によります。
[SRC[>>36]]

[FIG(steps)[
=
[39] 
[VAR[A]] の[F[[[不透明起源]]である]]が[[真]]で、
[VAR[B]] の[F[[[不透明起源]]である]]が[[真]]で、
[VAR[A]] が [VAR[B]] の場合、
==
[40] 
[[真]]を返します。
=
[41] 
それ以外で、
[VAR[A]] の[F[[[項組起源]]である]]が[[真]]で、
[VAR[B]] の[F[[[項組起源]]である]]が[[真]]の場合、
==
[42] 
[VAR[ホストA]]
を、
[VAR[A]]
の[F[ホスト]]に設定します。
==
[43] 
[VAR[ホストB]]
を、
[VAR[B]]
の[F[ホスト]]に設定します。
== 
[44] 
[VAR[ホストA]]と[VAR[ホストB]]が[[等しいホスト][host equals]]で、
[VAR[ホストA]]の[F[登録可能ドメイン]]が [CODE[null]] で''ない''場合、
===
[45] 
[[真]]を返します。
==
[46] 
それ以外で、
[VAR[ホストA]]の[F[登録可能ドメイン]]が[VAR[ホストB]]の[F[登録可能ドメイン]]で、
[VAR[ホストA]]の[F[登録可能ドメイン]]が [CODE[null]] で''ない''場合''、
=== 
[47] 
[[真]]を返します。
== 
[48] 
それ以外の場合、
===
[49] 
[[偽]]を返します。
=
[50] 
それ以外の場合、
==
[51] 
[[偽]]を返します。
]FIG]

[52] 
[[起源]]
[VAR[A]]
と[[起源]]
[VAR[B]]
が[DFN[[RUBYB[[RUBY[同][おな]]じサイト][same site]]]]であるか否かは、
次によります
[SRC[>>36]]。

[FIG(steps)[
= [53] 
[VAR[A]] と [VAR[B]] が[[schemeなしで同じサイト]]で''ない''場合、
==
[57] 
[[偽]]を返します。
=
[58] 
それ以外で、
[VAR[A]] の[F[[[不透明起源]]である]]が[[真]]で、
[VAR[B]] の[F[[[不透明起源]]である]]が[[真]]の場合、
== 
[59] 
[[真]]を返します。
=
[60] それ以外で、
[VAR[A]] の[F[[[項組起源]]である]]が[[真]]で、
[VAR[B]] の[F[[[項組起源]]である]]が[[真]]で、
[VAR[A]] の [F[scheme][URL scheme]] が [VAR[B]] の [F[scheme][URL scheme]]
である場合、
==
[61] 
[[真]]を返します。
= [54] 
それ以外の場合、
==
[56] 
[[偽]]を返します。
]FIG]

;; [62] 
[[同じ起源]]かどうかとは違って、
[[ポート]]の違いは無視されます。

;;
[63] 
[[起源]]の[F[ドメイン]]は無視されます。
従って
[CODE[document.domain]]
の影響は受けません。

[HISTORY[
[55] 
これら[[比較]]方法の定義は、
[TIME[令和元(2019)年][2019]]の
[CITE[HTML Standard]]
改定で追加されました
[SRC[>>36]]。

[68] それ以前は
[CITE[URL Standard]]
で規定されていましたが、
[[same site]]
が後の
[[schemelessly same site]]
の意味でした [SRC[>>67]]。
]HISTORY]

[69] 
これらは [[PSL]] の[[相互運用性]]の問題に由来する[[セキュリティー]]の懸念から
[SRC[>>67]]、
可能なら避ける[SHOULD[べき]]で、
[[同じ起源]]かどうかによることが好ましいとされています
[SRC[>>36]]。
実際にはいくつかの新しい機能で採用されています。


* 文脈

@@
[4] [[Storage Standard]]

[5] [[Web Storage]] のサイズ制限 ([[ストレージ (Web)]] 参照)。

* 歴史

[FIG(quote)[
[FIGCAPTION[
[1] [CITE[IRC logs: freenode / #whatwg / 20150911]]
([TIME[2015-09-12 14:18:28 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20150911>
]FIGCAPTION]

> # '''['''09:47''']''' <annevk> I want a term for eTLD+1, I was thinking "site" but a URL's site just seems rather wrong
> # '''['''09:48''']''' <annevk> That's one of the things blocking a more formal definition of public suffixes in URL

]FIG]

[3] [CITE@en[Allow POSTs to same eTLD+1 endpoints. · w3c/webappsec-credential-management@d30032e]]
([TIME[2016-02-19 15:48:33 +09:00]] 版)
<https://github.com/w3c/webappsec-credential-management/commit/d30032e1a439089460a6801987a7748d8d6de010>

[FIG(quote)[
[FIGCAPTION[
[7] [CITE@en[RFC 7489 - Domain-based Message Authentication, Reporting, and Conformance (DMARC)]]
( ([TIME[2016-05-31 06:53:47 +09:00]]))
<https://tools.ietf.org/html/rfc7489#section-3.2>
]FIGCAPTION]

> 
>    Thus, since "com" is an IANA-registered TLD, a subject domain of
>    "a.b.c.d.example.com" would have an Organizational Domain of
>    "example.com".

]FIG]


[FIG(quote)[
[FIGCAPTION[
[8] [CITE@en[View the Public Suffix List]]
( ([TIME[2016-05-05 01:22:01 +09:00]]))
<https://publicsuffix.org/list/>
]FIGCAPTION]

> The registered or registrable domain is the public suffix plus one additional label.

]FIG]


[9] [CITE@en[Re: VC meeting to discuss Permissions spec]]
( ([[Anne van Kesteren]]著, [TIME[2016-06-09 18:35:56 +09:00]]))
<https://lists.w3.org/Archives/Public/public-webappsec/2016Jun/0036.html>

[FIG(quote)[
[FIGCAPTION[
[10] [CITE@en[publicsuffix: cannot derive eTLD+1 for domain "s3.cn-north-1.amazonaws.com.cn" · Issue #14734 · golang/go]]
( ([TIME[2016-06-10 18:14:03 +09:00]]))
<https://github.com/golang/go/issues/14734>
]FIGCAPTION]

> "s3.cn-north-1.amazonaws.com.cn" is in https://publicsuffix.org/list/public_suffix_list.dat , so I think this is working as intended.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[11] [CITE@en[Web Authentication: An API for accessing Scoped Credentials]]
( ([TIME[2016-06-02 01:04:34 +09:00]]))
<https://w3c.github.io/webauthn/#etld1>
]FIGCAPTION]

> Also known as a Registered Domain '''['''PSL''']''', an eTLD+1 is an effective Top-Level Domain Name (eTLD), plus the next domain name label, proceding from right to left. 

]FIG]


[12] [CITE@en[Clear entire eTLD+1 for cookies.]]
([[@annevk]]著, [TIME[2016-07-20 19:57:38 +09:00]])
<https://github.com/w3c/webappsec-clear-site-data/commit/9b510bfa74223535670aba8a00177af883b28a8a>

[18] [CITE@en[For users on very slow connections, block document.written scripts · Issue #17 · WICG/interventions]]
([TIME[2016-10-25 13:13:46 +09:00]])
<https://github.com/WICG/interventions/issues/17>

[FIG(quote)[
[FIGCAPTION[
[19] [CITE@ja-JP[AWS | Elastic Load Balancing | Classic Load Balancer のよくある質問]]
( ([TIME[2016-12-02 11:11:38 +09:00]]))
<https://aws.amazon.com/jp/elasticloadbalancing/classicloadbalancer/faqs/>
]FIGCAPTION]

> Q: 自分のドメイン (例えば、http://example.com) の zone apex へのトラフィックのロードバランスを実行できますか?
> はい。詳細については、Elastic Load Balancing 開発者ツールをご参照ください。

]FIG]


[20] [CITE@en[For users on very slow connections, block document.written scripts · Issue #17 · WICG/interventions]]
([TIME[2017-07-15 23:59:49 +09:00]])
<https://github.com/WICG/interventions/issues/17>

[21] [CITE[Intelligent Tracking Prevention | WebKit]]
([TIME[2017-09-26 23:23:28 +09:00]])
<https://webkit.org/blog/7675/intelligent-tracking-prevention/>

[22] [CITE@en[Define hosts' public suffix and registrable domain, as well as same site]]
([[mikewest]]著, [TIME[2018-06-07 18:11:56 +09:00]])
<https://github.com/whatwg/url/commit/6a9f7eacaae962b325547f33d6e30134789986a8>

[23] [CITE@en[Define hosts' public suffix and registrable domain. by mikewest · Pull Request #391 · whatwg/url]]
([TIME[2018-06-13 22:13:23 +09:00]])
<https://github.com/whatwg/url/pull/391>

[24] [CITE@en[Build upon URL rather than PSL]]
([[annevk]]著, [TIME[2018-06-07 18:31:20 +09:00]])
<https://github.com/whatwg/html/commit/326c64415ddff5f619433028bd5d99408dad6430>

[25] [CITE@en[Define Cross-Origin-Resource-Policy response header]]
([[annevk]]著, [TIME[2018-06-18 22:36:30 +09:00]])
<https://github.com/whatwg/fetch/commit/0cec471b1ba938d775415e2ea08a2d2be4e72413>

[26] [CITE[Intelligent Tracking Prevention 2.0 | WebKit]]
([TIME[2018-06-21 02:16:10 +09:00]])
<https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/>

[27] [CITE@en[Restructure URL rendering section and add additional guidance]]
([[estark37]]著, [TIME[2019-04-04 23:49:46 +09:00]])
<https://github.com/whatwg/url/commit/8809598ddfd1d935432c8a0cad53f13d70e24bc6>

[FIG(quote)[
[FIGCAPTION[
[28] [CITE@en-US[Unfurling links in messages | Slack]]
([[Slack]], [TIME[2020-10-02T07:15:47.000Z]])
<https://api.slack.com/reference/messaging/link-unfurling#configuring_domains>
]FIGCAPTION]

> Domains must have a TLD and cannot be a TLD alone (example.com and another.example.com are valid, example is not and nor is .com).

]FIG]

[66] [CITE@en[Treat http://foo.com -> https://foo.com requests as `Sec-Fetch-Site: cross-site`. · Issue #34 · w3c/webappsec-fetch-metadata · GitHub]], [TIME[2022-01-12T09:19:53.000Z]] <https://github.com/w3c/webappsec-fetch-metadata/issues/34>

[70] [CITE@en[Tighten 'same site' checks to include 'scheme'. by mikewest · Pull Request #449 · whatwg/url · GitHub]], [TIME[2022-01-12T09:25:18.000Z]] <https://github.com/whatwg/url/pull/449>


[67] [CITE@en[Let HTML handle the "same site" definition]]
([[domenic]], [TIME[2019-11-21 02:41:22 +09:00]], [TIME[2022-01-12T09:22:19.000Z]])
<https://github.com/whatwg/url/commit/3703f92854207564b21301418d28a0ac647be06d>



[36] [CITE@en[Define (schemelessly) same site for origins]], [[domenic]], [TIME[2019-11-20 01:54:54 +09:00]], [TIME[2022-01-12T08:49:33.000Z]] <https://github.com/whatwg/html/commit/d0149490ef2dd11e3be53481516d59298694e4c9>

[64] [CITE@en[Consider introducing a "same-site" concept that includes scheme. · Issue #448 · whatwg/url · GitHub]], [TIME[2022-01-12T09:17:04.000Z]] <https://github.com/whatwg/url/issues/448>

[65] [CITE@en[Define (schemelessly) same site for origins by domenic · Pull Request #5076 · whatwg/html · GitHub]], [TIME[2022-01-12T09:17:21.000Z]] <https://github.com/whatwg/html/pull/5076>

[71] [CITE@en[Let HTML handle the "same site" definition by domenic · Pull Request #457 · whatwg/url · GitHub]], [TIME[2022-01-12T09:27:44.000Z]] <https://github.com/whatwg/url/pull/457>



[72] [CITE@en[Editorial: use origin-based "schemelessly same site"]]
([[domenic]], [TIME[2019-11-21 02:42:34 +09:00]], [TIME[2022-01-12T09:29:15.000Z]])
<https://github.com/whatwg/fetch/commit/493c02127f49d6e9a4df5d56e2fcfa7fbaff48b2>

[73] [CITE@en[Editorial: use origin-based "same site" definition by domenic · Pull Request #965 · whatwg/fetch · GitHub]], [TIME[2022-01-12T09:30:17.000Z]] <https://github.com/whatwg/fetch/pull/965>