-
Notifications
You must be signed in to change notification settings - Fork 4
/
623.txt
1109 lines (851 loc) · 60.7 KB
/
623.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[115] [DFN[[RUBYB[[[リファラー]]]@en[referrer]]]]は、 [[fetch]] の発生元の
[[URL]] です。
[111] [DFN[[CODE[Referer:]] 欄]]は、 [[HTTP]]
などで使われる[[頭欄]]で、[[リンク]]先の[[資源]]を取り寄せる時に、
その参照元を示すために使います。
* 仕様書
[REFS[
- [65] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-5.5.2>
- [3] [CITE@en[Referrer Policy]] ([TIME[2016-05-21 07:45:08 +09:00]]) <https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer>
- [60] [CITE@en[Referrer Policy]] ([TIME[2016-05-21 07:45:08 +09:00]]) <https://w3c.github.io/webappsec-referrer-policy/#strip-url>
- [102] [CITE@en[Referrer Policy]] ([TIME[2016-05-21 07:45:08 +09:00]]) <https://w3c.github.io/webappsec-referrer-policy/#user-controls>
- [105] [CITE@en-US[Fetch Standard]] ([TIME[2016-05-24 18:42:15 +09:00]]) <https://fetch.spec.whatwg.org/#concept-request-referrer>
- [107] [CITE@en-US[Fetch Standard]] ([TIME[2016-05-24 18:42:15 +09:00]]) <https://fetch.spec.whatwg.org/#concept-main-fetch>
- [91] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-05-24 17:09:37 +09:00]]) <https://html.spec.whatwg.org/#the-document's-referrer>
- [205] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-05-24 17:09:37 +09:00]]) <https://html.spec.whatwg.org/#dom-document-referrer>
- [169] [CITE@en[Service Workers Nightly]] ([TIME[2017-03-02 15:00:14 +09:00]]) <https://w3c.github.io/ServiceWorker/#job-referrer>
]REFS]
* 呼称
[42] Referer は referrer の typo だけど、もはや直しようがない。
[45] [[HTTP]] 以外は正しく referrer と呼んでいたりする。
[132] [CODE@en[Referrer]] を採用しているもの:
[FIG(list)[
- [42] [CODE(JS)@en[[[document.referrer]]]] ([[DOM]])
- [112] [CODE(HTML)@en[[[rel=noreferrer]]]]
- [113] [CODE(HTML)@en[<[[meta]] [[name]]=[[referrer]]>]]
]FIG]
[133] [CODE@en[Referer]] を採用しているもの:
[FIG(list)[
- [110] [CODE(HTTP)@en[[[Referer:]]]] ([[HTTP]])
]FIG]
* 意味
[134] [CODE(HTTP)@en[[[Referer:]]]] [[ヘッダー]]は、
[[対象URL]]の取得元である[[資源]]の [[URL]] を[[利用者エージェント]]が指定するものです
[SRC[>>65]]。
[135] [[対象URL]]を得たのが [[URL]] を持たないものからである場合
(例えば[[キーボード]]からの入力や[[栞]]からの選択である場合) には、
[CODE(HTTP)@en[[[Referer:]]]] を含めないか、
[CODE(URI)@en[[[about:blank]]]] を指定するかのいずれかとしなければ[['''なりません''']]
[SRC[>>65]]。
;; [81] 実際に [CODE(URI)@en[[[about:blank]]]] を送る[[利用者エージェント]]が現存するのかは不明です。
* 構文
[82] [CODE(HTTP)@en[Referer:]] [[ヘッダー]]の値は、
[[RFC 3986]] [CODE(ABNF)@en[[[absolute-URI]]]] または
[CODE(ABNF)@en[[[partial-URI]]]] とされています。ただし、
[[素片識別子]]と [[userinfo]] を使っては[['''なりません''']]。 [SRC[>>65]]
[FIG(railroad)[
= |
== [[絶対URL]]
== [[部分URL]]
]FIG]
[186] [[Webブラウザー]]は必ず[[絶対URL]]とします。
[[部分URL]]とする実装があるのかは不明です。
受信者が[[部分URL]]を正しく扱えない虞がありますから、
[[クライアント]]は[[絶対URL]]を[[生成]]するべきです。
-*-*-
[136] [[URL]] [VAR[URL]] から[[参照元]]として使う [[URL]] を得るには、
[DFN[Strip [VAR[url]] for use as a referrer]] [SRC[>>60]]、
すなわち次のようにします。入力として[VAR[起源のみ]]フラグを持ちます。
[FIG(steps)[
= [137] [VAR[URL]] が [CODE[no-referrer]] なら、
== [138] [CODE[no-referrer]] を返し、ここで停止します。
= [92] [VAR[URL]] の [F[scheme][URL scheme]] が[[局所scheme]]なら、
== [94] [CODE[no-referrer]] を返し、ここで停止します。
= [95] [VAR[URL]] の[F[利用者名][userinfo]]を、[[空文字列]]に設定します。
= [96] [VAR[URL]] の[F[合言葉][userinfo]]を、 [[null]] に設定します。
= [97] [VAR[URL]] の[F[素片][素片識別子]]を、 [[null]] に設定します。
= [98] [VAR[起源のみ]]フラグが設定されていれば、
== [99] [VAR[URL]] の[F[path]] を、 [[null]] に設定します。
== [140] [VAR[URL]] の[F[query][URL query]] を、 [[null]] に設定します。
= [93] [VAR[URL]] を返します。
]FIG]
;; [139] 他にも、 [CODE(URI)@en[file:]] [[URL]] や[[ブラウザー拡張]]の
[[URL scheme]] などを [CODE[no-referrer]] とする必要があるかもしれません。
[187] [VAR[起源のみ]]かどうか、あるいは [CODE[no-referrer]] が使われるかどうかは、
[[参照元ポリシー]]により決まります。
* 要求の参照元の決定
[149] [[要求]]は、[DFN[[F[[RUBYB[[[参照元]]]@en[referrer]]]]]]を持ちます [SRC[>>105]]。
その値は、 [CODE[no-referrer]]、[CODE[client][要求クライアント]]、
[[URL]] のいずれかで、既定値は [CODE[client][要求クライアント]] です [SRC[>>105]]。
[150] [[HTTP]] は、参照元ページが[[保安プロトコル]]で受信したものの場合に、
[[利用者エージェント]]が[[非保安][保安プロトコル]] [[HTTP要求]]で
[CODE(HTTP)@en[Referer:]] [[ヘッダー]]を送信しては[MUST[ならない]]
[SRC[>>65]] と規定していました。これは現在も原則として維持されていますが、
[[著者]]の明示的な指定により上書きできるようになっています。
;; [[参照元ポリシー]]参照。
[85] [[main fetch]] における[[[VAR[要求]]の[F[参照元]]の決定]]は、次のようにします
[SRC[>>107]]。
[FIG(steps)[
= [151] [VAR[要求]]の[F[参照元ポリシー]]が[[空文字列]]で、
[VAR[要求]]の[F[クライアント]]が [[null]] で''ない''なら、
== [152] [VAR[要求]]の[F[参照元ポリシー]]を、[VAR[要求]]の[F[クライアント]]の[F[参照元ポリシー]]に設定します。
= [153] [VAR[要求]]の[F[参照元ポリシー]]が[[空文字列]]なら、
== [154] [VAR[要求]]の[F[参照元ポリシー]]を、 [CODE[no-referrer-when-downgrade]]
に設定します。
= [155] [VAR[要求]]の[F[参照元]]が [CODE[no-referrer]] 以外なら、
== [156] [VAR[要求]]の[F[参照元]]を、
[VAR[要求]]に [[determine [VAR[request]]'s referrer]] を適用した結果に設定します。
]FIG]
[157] [VAR[要求]]について [DFN[Determine [VAR[request]]’s Referrer]]
は、次のようにします [SRC[>>3]]。
[FIG(steps)[
= [158] [VAR[設定群]]を、[VAR[要求]]の[F[クライアント][要求クライアント]]に設定します。
= [159] [VAR[文書]]を、 [[null]] に設定します。
= [160] [VAR[要求]]の[F[参照元]]が [[URL]] なら、
== [161] [VAR[参照元源]]を、[VAR[要求]]の[F[参照元]]に設定します。
= [162] それ以外で、[VAR[要求]]の[F[参照元]]が [CODE[client][要求クライアント]]なら、
== [163] [VAR[設定群]]の[F[大域オブジェクト]]が [CODE(DOMi)@en[Window]] なら、
=== [164] [VAR[文書]]を、[VAR[設定群]]の[F[有責閲覧文脈]]の[F[文書]]に設定します。
=== [213] [VAR[文書]]の[F[起源][文書の起源]]が[[不透明起源]]なら、
==== [214] [CODE[no-referrer]] を返し、ここで停止します。
=== [215] [VAR[文書]]の [F[[[[CODE(HTMLe)@en[iframe]] [CODE(HTMLa)@en[srcdoc]]文書]]]]が[[真]]である間、繰り返し、
==== [216] [VAR[文書]]を、[VAR[文書]]の[F[閲覧文脈]]の[F[閲覧文脈包含子]]の[F[節点文書]]に設定します。
=== [217] [VAR[参照元源]]を、[VAR[文書]]の[F[URL][文書の番地]]に設定します。
== [165] それ以外なら、
=== [218] [VAR[参照元源]]を、[VAR[設定群]]の[F[作成URL]]に設定します。
= [177] [VAR[参照元URL]]を、[VAR[参照元源]]に [[Strip url for use as a referrer]]
を適用した結果に設定します。
= [178] [VAR[参照元起源]]を、[VAR[参照元源]]に [[Strip url for use as a referrer]]
を適用した結果に設定します。このとき[VAR[起源のみ]]フラグを[[真]]に設定します。
= [224]
[VAR[参照元URL]]を[[直列化][URLの直列化]]した結果の[F[長さ][文字列長]]が
[N[4096]]
[[より大きい]]場合、
== [225]
[VAR[参照元URL]]
を、
[VAR[参照元起源]]に設定します。
= [226]
情報漏洩を最小化すべく何らかの基準に則り[VAR[参照元URL]]
や[VAR[参照元起源]]を変更して[MAY[構いません]]。
[EG[
[227]
[[URL]] を[[起源]]にまで縮めたり、
[[ホスト][URL host]]を変更したり、
[[空文字列]]に置き換えたりして構いません。
]EG]
= [179] [VAR[方針]]を、[VAR[要求]]の[F[参照元ポリシー]]に設定します。
= [180] [VAR[downgrade]] を、
[FIG(list)[
- [182] [VAR[設定群]]が [[null]] でない
- [183] [VAR[設定群]]が[[TLS保護]]されている
- [184] [VAR[要求]]の[F[現在URL]]が [[a priori authenticated URL]] で''ない''
]FIG]
... のすべてを満たすかどうかに設定します。
= [166] [VAR[交差起源要求]]を、[VAR[要求]]が[[交差起源要求]]かどうかに設定します。
= [188] 次の表に従って値を返します。
[FIG(table)[
:policy: [VAR[方針]]
:same-origin: 非[VAR[交差起源要求]]
:cross-origin: [VAR[交差起源要求]]かつ非[VAR[downgrade]]
:downgrade: [VAR[交差起源要求]]かつ[VAR[downgrade]]
:policy: [CODE[no-referrer]]
:same-origin: [CODE[no-referrer]]
:cross-origin: [CODE[no-referrer]]
:downgrade: [CODE[no-referrer]]
:policy: [CODE[origin][Referrer Policy]]
:same-origin: [VAR[参照元起源]]
:cross-origin: [VAR[参照元起源]]
:downgrade: [VAR[参照元起源]]
:policy: [CODE[strict-origin]]
:same-origin: [VAR[参照元起源]]
:cross-origin: [VAR[参照元起源]]
:downgrade: [CODE[no-referrer]]
:policy: [CODE[unsafe-url]]
:same-origin: [VAR[参照元URL]]
:cross-origin: [VAR[参照元URL]]
:downgrade: [VAR[参照元URL]]
:policy: [CODE[no-referrer-when-downgrade]]
:cross-origin: [VAR[参照元URL]]
:same-origin: [VAR[参照元URL]]
:downgrade: [CODE[no-referrer]]
:policy: [CODE[same-origin][Referrer Policy]]
:same-origin: [VAR[参照元URL]]
:cross-origin: [CODE[no-referrer]]
:downgrade: [CODE[no-referrer]]
:policy: [CODE[origin-when-cross-origin]]
:cross-origin: [VAR[参照元起源]]
:same-origin: [VAR[参照元URL]]
:downgrade: [VAR[参照元URL]]
:policy: [CODE[strict-origin-when-cross-origin]]
:cross-origin: [VAR[参照元起源]]
:same-origin: [VAR[参照元URL]]
:downgrade: [CODE[no-referrer]]
]FIG]
]FIG]
[228]
[TIME[令和元(2019)年][year:2019]]の改訂で、[[利用者エージェント]]はプライバシー保護のための任意の改変を加えて良いとの規定が追加されました。
状況に応じた[[Webブラウザー]]依存の特例的な措置が現に行われている
(または行われようとしている) のを追認するものですが、
明確な範囲と挙動を[[仕様書]]に記述せず任意の措置を認めてしまっており、
[[仕様書]]の[[アルゴリズム]]の空文化を招いてしまいました。
[[仕様書]]解釈論的には任意の挙動が[[適合]]することになって、
[[規定]]の意味をなしません。
* Referer: 欄の中身
[76] [CODE(HTTP)[Referer]] URI として報告例のある scheme は、
:[CODE(URI)[[[http]]]]:[[HTTP]]
:[CODE(URI)[[[https]]]]:HTTP over [[SSL]]/[[TLS]]
:[CODE(URI)[[[news]]]]:[[Usenet]] ([SAMP(URI)[news://foo.example/]])
:[CODE(URI)[[[about]]]]:[SAMP(URI)[[[about:blank]]]] (一時の Classic Mozilla の不具合らしい。)
:[CODE(URI)[[[file]]]]:Local file
:[CODE(URI)[[[webster]]]]:[SAMP(URI)[Webster://Internal/StatusPage]]
:[CODE(URI)[[[xxxx]]]]:串による書き換え
こんなものかな。 [CODE(URI)[[[gopher]]]] とか [CODE(URI)[[[ftp]]]] とかもあってもよさそうだけど、確認されていますか?
[84] 普通の一般目的[[利用者エージェント]]は、 [CODE(URI)@en[[[data:]]]] や
[CODE(URI)@en[[[file:]]]] の [[URL]] は [CODE(HTTP)@en[[[Referer:]]]]
で送りません。 [SRC[>>65]]
** 相対 URI
[144] >>82 によればこの欄の値は相対 URI でも良いみたいですが、
そういうのは見たことがないですね。
絶対 URI にした方がいい気がします。
[142] SuikaWiki の Referer plugin も相対 URI には実は対応していなかった気が。
[143] 一部の版の [[IE]] や一部の[[検索円陣]]索引付け器が相対 URI
で [CODE(HTTP)[Referer:]] を送ってくるそうです。
[54] それから、一部の腐った索引付け器は
[SAMP(URI)[www.example.com/]] のような相対 URI もどきを送りつけるそうです。
** 素片識別子
[145] ''Bug 179400 - URI fragment present in HTTP Referer'' <http://bugzilla.mozilla.org/show_bug.cgi?id=179400>
Mozilla では、最近 (2002年末) まで Referer URI に[[素片識別子]]もつけて送ってしまうという不具合がありました。 (HTTP RFC ははっきり禁止しています >>82。)
多分他にも素片識別子を送る UA は少なくないと想像されます。
** ロボットの身元申告
[146] 特に昔の[[ロボット]]なんかは、
その身元を表す文書がある [[URI]]
を [CODE(HTTP)[Referer:]] 欄で送ってくることがありました。
身元を表明するという意味ではよい心がけですが、
本来の使い方からそれており好ましいことではありません。
幸い最近はそういうのは減っているようです。
[147] [[なつみかん]]なんかは設定項目がわざわざあって、
アンテナの結果表示 URI を指定するようにと指導されていました。
リンクを広義に解釈すれば必ずしも間違いとも言い切れませんが、
なんだかなあという気はしました。
[148] なお、身元申告には本来 [CODE(HTTP)[[[From]]:]] 欄を使うのがよいとされています。
実際、最近のロボットは [CODE(HTTP)[From:]] 欄に連絡先メイル・アドレスを入れてきます。
但し、 [CODE(HTTP)[From:]] 欄の中身はあくまでメイル・アドレスでして、
参照して欲しい URI 参照を入れることは残念ながらできません。
ですから、身元申告文書の URI 参照を入れる標準の頭欄で最も適切なのは
[CODE(HTTP)[[[User-Agent]]:]] 欄です。 (しかし、単なる文字列の一部でしかないので機械処理ができない諸刃の剣。素人は [CODE(HTTP)[User-Agent:]] 欄に入れるときには[[注釈]]にしないといけないことにも注意されたし。)
* 文脈
[141] [[利用者エージェント]]は[[要求]]に [CODE(HTTP)@en[[[Referer:]]]]
[[ヘッダー]]を指定することができます。
[75] しかしこの[[ヘッダー]]は必須ではありません。[[対象URL]]
が[[利用者]]の直接入力など他の[[資源]]以外に由来する場合や、
[[利用者]]の設定や[[著者]]の指定により [CODE(HTTP)@en[[[Referer:]]]]
[[ヘッダー]]を送信しないことになっている場合は、
この[[ヘッダー]]は送信されません。
[219] [[WebSocket接続の確立]]では、[[参照元ポリシー]]に関わらず、 [CODE[Referer:]] は使われません。
** 変な Referer
- [30] ''http://inazuma/content?[VAR[...]]'' という Referer
値が引っかかることがあります。検索してみると Referer log は大量にかかります。
が、 inazuma の正体に触れた情報はほとんどありません。
- [31] ''http://inazuma/*とは?'' <http://misuzilla.org/docs/inazuma>
で同じように疑問が呈されていて、正体の'''可能性'''のあるものが書いてあります。
検索系の串っぽいです。
- [32] それにしても、[[完全修飾ドメイン名]]でない値を送るなんて [[UA]] もどうかしてます。
([[WinIE]] だろうか。)
- [33] [WEAK[2002-12-17 (火) 14:59]] ''[[Name_Not_Found]]'': <IW:Google:"\"http://inazuma/content\"">
- [44] ''Proxomitron-J / 少年ナイフの Referer について'' <http://www.pluto.dti.ne.jp/~tengu/proxomitron/kniferef.html>: 作者の好きな URI を必ず Referer にしていたソフトウェアの例。その URI の使用者の側に迷惑をかけたからその仕様はやめたらしい。
- [51] [CODE(HTTP)[ [unknown origin] ]]
- [59] >>51 は一部の[[防火壁]][[串]]が元あった Referer を削除して代わりに書き加えるみたいです。
- [61] 壊れた[[検索円陣]]索引付け器は適当な整数値を [CODE(HTTP)[Referer:]] で送りつけてくることがあるそうです。
[80] [SAMP(HTTP)[Referer: <!--#exec cmd="ls"-->]]
のようなものが送られてくることがあります。
[CODE(HTTP)[[[Referer]]]] を記録していて、
その結果が [[HTML]] [[ファイル]]に出力されて、
その[[ファイル]]で [[SSI]] が有効になっているのに、
[[HTML]] 化時の[[逃避]]が行われていない、
なんていう一昔前にあちこちで起こっていそうな光景
[WEAK[(今はしらん。)]] を想像しているのでしょうね。
[SAMP[ls]] だからよいもの、 [[Apache]]
が [CODE[[[root]]]] で動いている上に [SAMP[[[rm]] -fr /]]
だった日には[AA[(w]]。
([[名無しさん]] [sage] [WEAK[2005-06-03 11:40:21 +00:00]])
** 栞
[5] 栞から辿った場合に、 "Referer: bookmarks"
をつける [[UA]] があるみたいです。
([[User-Agent:欄]]の値: "Mozilla/4.7 [ja] (Macintosh; U; PPC)")
- [55] 最近の [[Mozilla]] は[WEAK[いつからかしりませんが]]栞の項目の設定画面で、その栞を挟んだ [[URI]] を参照するときに使われる [CODE(HTTP)[Referer]] の値が設定できるみたいです。
** Referer 漏れ
[127] [[IE]] で、特定の条件でリンクを辿っていないのに閲覧した無関係の
[[URI]] が送られることがある。
[57] 同じような Referer 漏れに見える、
2種類の現象があります。
- Referer は送られない様に設計されているはずなのに、なぜか条件が揃うと送られてしまう — 90年代後半に幾つかのブラウザで見つかったバグ。
- 何も考えてないので、よく考えれば
(あるいは現在の価値観からすれば)
送らないで欲しいのだけど、
そのブラウザの仕様上「正しく」
送られてしまう — 90年代中頃までに幾つかのブラウザに見られた状況。
[4] 古い [[NetscapeNavigator]] でも起こったようです。
- [10] [WEAK[2002-11-21 (木) 19:12]] ''[[Name_Not_Found]]'': この wiki のあちこちで、(現時点では) 絶対ありえない <http://suika.fam.cx/> の referer が観測されておるのだが・・・
- [22] [CODE[MosaicView/2.0009 Win32 NEC/9]] という太古(1996)の [[Mosaic]] variant は、リンクをたどっていないにもかかわらず直前の [[URI]] を送ります。しかもそれが [[file:]] URI でもお構いなく。
- [23] [WEAK[2002-12-06 (金) 16:05]] ''[[Name_Not_Found]]'': MosaicView/2.0009 Win32 NEC/9
[56] >>22 Mosaic Netscape 0.9
もそんなもんです。
古い時代は今とは違った privacy
感覚でしたから。。。
- [24] [WEAK[2002-12-13 (金) 18:39]] ''>>10'': どっかの糞 UA または privacy を謳う串の類が、適当にそこのサーバーのルートを Referer として送ってくるんじゃないか? だれか検証してみてくれ。
- [41] >>127- の Referer 漏れとちょっと趣が異なりますが、 [[JavaScript]] の [CODE[location.href]] を使って飛んだ場合に、 [[UA]] によっては Referer が送られます。普通は問題ないのですが、この JavaScript が [[Bookmarklet]] だった場合で、例えば利用者に入力を求めてその入力に従って移動するようなものであったら、全く関係ない URI が Referer として送られてしまうことになります。 ([[Mozilla]] とかでなります。送られるのは [[javascript:]] ではなくて既に表示されている URI なんですね)
[68]
[CITE[スラッシュドット ジャパン | EZwebブラウザに不正なReferer送出を行う不具合]] <http://slashdot.jp/security/05/12/09/1021257.shtml>
([[名無しさん]] [WEAK[2005-12-10 03:12:19 +00:00]])
[69]
[CITE[JP Vendor Status Notes]] <http://jvn.jp/jp/JVN%2315243167/index.html>
([[名無しさん]] [WEAK[2005-12-10 03:19:09 +00:00]])
[[#comment]]
** 参考
- (IE の Referer 漏れについての話) <http://www.st.ryukoku.ac.jp/~kjm/security/memo/referer-bug.txt>
- [43] ''Re:'' <http://www.st.ryukoku.ac.jp/~kjm/security/memo/referer-bug.txt>
- [128] ''Get Rid Of The Turkeys Who Use'' <http://www.webmasterworld.com/forum23/2040-3-15.htm>: 種々の UA が送ってくる Referer の形式的分類がありまして、参考にさせていただいています。
* 処理
[EG[
[189] [CODE(HTTP)@en[[[Referer:]]]] [[ヘッダー]]は、例えば次のような用途に使うことができます
[SRC[>>65]]。
[FIG(list)[
- [190] [[逆リンク]]の生成
-- [191] 解析
-- [71] 記録
-- [72] キャッシュ最適化
- [73] 他のサイトからの[[リンク]]の拒否
- [70] [[CSRF]] 対策
]FIG]
]EG]
[74] 外行きの[[要求]]の [CODE(HTTP)@en[[[Referer:]]]] [[ヘッダー]]をすべて除去する[[中間器]]もあることが知られています。
しかしそれによって [CODE(HTTP)@en[[[Referer:]]]] [[ヘッダー]]による [[CSRF]]
対策を[[鯖]]が行えなくなりますから、より[[利用者]]を危険に晒すことになりかねません。 [SRC[>>65]]
[86] [[中間器]]や[[利用者エージェント]]が情報漏洩を防止したいときは、
内部[[ドメイン名]]を[RUBYB[ペンネーム]@en[pseudonym]]に置き換えたり、
[[path]] や [[query]] を削除したりするなどの変更に留める[RUBYB[べき]@en[ought to]]です。 [SRC[>>65]]
[87] [[中間器]]は、 [CODE(HTTP)@en[[[Referer:]]]] [[ヘッダー]]の値の
[[URL scheme]] や [[host]] が[[要求対象]]と同じ時は、これを編集したり、
削除したりする[['''べきではありません''']] [SRC[>>65]]。
-*-*-
[170] [[ジョブ][サービスワーカージョブ]]は、
[DFN[[F[[RUBYB[[[参照元]]]@en[referrer]]]]]]を持ちます。
値は [[URL]] または [CODE[null]] です。 [SRC[>>169]]
** Referer による接続制御
[1] Referer: 欄の値により、接続制御することがあります。
例えば画像資源において、 Referer: 値が自分のサーバー内を指すものと思われないときには資源を渡さないという方法は良く使われます。
しかしこの方法は Referer を返さない[[利用者エージェント]]に対しては正しく動作しない可能性が強いですし、そうでなくても
World Wide Web の最大の特徴の一つである[[ハイパーリンク]]に対して著しく不利益を与えるものです。
ですから、 Referer による接続制限は、それによる影響を十分に理解した上で、どうしても必要な場合においてのみ行うように、慎重に検討する必要があります。また、その場合においても
Referer を返さない[[利用者エージェント]]に対して不利益がないように十分考慮しなければならないでしょう。
(Referer を返す [[UA]] でご利用下さい、はそれだけで既に不利益です。)
[2] なお、 Referer は [[HTTP]] において必須の欄ではありません。プライバシーの観点から値を与えない実装も数多く存在します。
[[#comment]]
* Referer による逆リンク作成
[66]
Referer 情報は鯖側で様々な用途に利用できますが、仕様書 ([[RFC 2616]])
にも言及がある代表的な使用例の一つが[[逆リンク]]一覧の作成です。
Referer 情報を見ることにより、
ある[[資源]]に関する言及の所在をその[[資源]]の[[著者]]が容易に発見できます。
[67]
Referer 情報は閲覧者が直前に何を見ていたかの情報であり、
ともすればプライバシーの問題にもなりかねません。 [[RFC 2616]]
は[[利用者エージェント]]に、[[利用者]]が referer
情報を送信するかどうかを選択できることを求めています。
Referer 情報を逆リンクなどの形で公表されたとしても、
閲覧者がそれを[[著者]]に抗議したり、
不快感を示したりするのはお門違いです。
[[#comment]]
* いつ Referer を送るか
[11] Referer:
欄に値を入れて送る場合には、例えば次の場面があり得ます。
- [12] ハイパーリンクを順方向に辿る場合
-- ([CODE(HTML)[[[a]]]],
や [CODE(HTML)[[[link]]]], [[XLink]] の[[単純リンク]]など)
- [14] ブラウザの項目などから飛ぶ場合 (>>5 も参照)
- [15] [[UA]] の機能によるハイパーリンクから飛ぶ場合
-- (文書中の [[URI]] を押した場合とか。)
-- ([[WinIE]] の[[スマートタグ]]のような仕組みとか。)
- [13] 埋め込み資源を取り寄せる場合
-- (画像, [[スタイル・シート]], [[スクリプト]]など)
-- [39] [CODE(HTML)[[[frameset]]]]/[CODE(HTML)[[[frame]]]] とか
[[XFrames]] とか。
- [37] 入力欄の値を送信する場合
-- ([CODE(HTML)[[[form]]]], [[XForms]] など)
[[#comment]]
[16] どういう時に Referer URI を送るかは、実装依存です。
(サーバー側は何らの仮定もするべきではありません。)
ただ常識的に考えて、 Referer を送る場合は >>12
は必須でしょう。
- [9] [[Mozilla]] では、 ''user_pref("network.http.sendRefererHeader", 0/1/2);'' で Referer を送るか制御できます。 0 で不送信, 1 でリンクを辿った時送信, 2 で1に加えて埋め込み画像などの取得にも送信で、 2 が既定値です。
- [38] [SAMP[html]] が [SAMP[css1]] を参照していて、 [SAMP[css1]] が更に [SAMP[css2]] を参照しているとします。この時、 [SAMP[css1]] と [SAMP[css2]] のどちらを取り寄せる時にも [SAMP[html]] の URI を送る UA があります (具体的には [[WinIE]])。しかしこれはおかしいと思われます。
[63]
フレームとしてのリンク ([CODE(HTMLe)[[[frame]]]]) は実際に UA
によって [CODE(HTTP)[[[Referer:]]]] を送ったり送らなかったりするようです。
([[名無しさん]] [sage] [WEAK[2005-02-03 23:22:24 +00:00]])
[[#comment]]
** どういうときに Referer を送らないか
[17] 利用者のプライバシーを考えつつも、分析目的の Referer
情報をサーバーに提供するために、例えば次のような実装が考えられます。
- [18] 同じサーバーの URI なら送信する。
- [19] 特定の{サーバー|種類(scheme)}の URI なら送信{する|しない}。
- [20] 例えば検索円陣の URI は送信しないで欲しい、
のような利用者の要望に応えられる実装が望ましいでしょう。
- [34] [WEAK[2002-12-17 (火) 15:01]] ''[[Name_Not_Found]]'': >>32 のように、 [[FQDN]] 以外を参照する [[URI]] は送信するべきではないでしょう。 Private などの[[特殊-IPv4-address]], [[特殊IPv6アドレス]]も同様。
- [46] [CODE(URI)[[[https:]]]] な世界から [CODE(URI)[[[http:]]]] な世界に移るときに Referer が送られるのを気にする人もいます。多分本質的には気になることではないと思うのですが、安全なはずの世界の側のへたれ実装が、 [CODE(URI)[https:]] だからといって[[合言葉]]に準じるものを URI に含めていたりしたら問題ですね。まあそんな設計者が悪いんですが。
- [47] それとか、素の HTTP であっても、[[認証]]が使われている世界から使われていない世界、あるいは違う [[realm]] な世界に行く時にも注意が必要です。もちろんこっちの場合も、合言葉やそれに準じるものを URI に使ったりするほうが悪いんですが。それに制限領域だからといって URI がばれると困るような設計はどうかと思うんですが。だけど現実問題、やっぱり >>46 もこれも気にした方がいいのかもなあ。
- [48] また、 HTTP でも [CODE(URI)[[[ftp:]]]] の場合でもその他の場合でも、 URI の最初の方に利用者名や合言葉を含めることができますが、安全性と個人情報保護の観点から、''必ず''削除するように注意した方がよいと思われます。
- [49] [[MUA]] にブラウザ部品を流用している [[UA]]
とかでは、内部的に使っているメッセージの URI
とかが流用してしまわないように注意するべきです。
-- でも[[ニュース]]の記事なんかなら、別に[[メッセージID]]の URI
が送られても構わない気がします。
-- 多くの実装の形態で言うところの[[フォルダ]]とかの区分ごとに利用者が指定できるのが一番いいでしょうか。
-- その指定に関わらず [[spam]] と判定されているメッセージの場合は絶対に送らないとか、細かい設定が出来るとなお良いですね。
- [50] [[付属文書系URI]] とかなら [CODE(URI)[[[file:]]]]
同様に送らないようにする、とかの UA の実装ごとの調整も必要でしょう。
-- [[scheme]] を利用者又は追加モジュールが容易に追加できる形態の
UA だったら、 default では送らないことにしておいて、
特に指定 (モジュールの定義で指定でも、利用者が指定でも、
なんでもいい。) した時にだけ送るようにするのがいいかも。
- [58] >>19,>>50 ブラウザにとって未知の scheme は、とりあえず送らないを既定にしておく方が色々安全でしょうね。
[220] [[内部名]]が使われている[[URL]]を非[[内部名]]の[[サーバー]]に送ってほしくないですが、
そのような制限はなく、送られてしまいます。
** 著者による Referrer 送信の制御
[114] [CITE[HTML - Referrer を制御する - Qiita]]
( ([TIME[2014-05-24 06:05:48 +09:00]] 版))
<http://qiita.com/wakaba@github/items/707d72f97f2862cd8000>
** 利用者の設定
[83] [CODE(HTTP)@en[[[Referer:]]]] によって要求の文脈や[[閲覧]]の履歴を晒すことによってプライバシー上の問題が生じるかもしれません。
例えば [[URL]] にはアカウント名など個人情報が含まれるかもしれませんし、
[[防火壁]]内などの秘密の[[資源]]の [[URL]] かもしれません。 [SRC[>>65]]
[103] [[利用者エージェント]]は、 [CODE(HTTP)@en[Referer:]] [[ヘッダー]]を送信しないオプションを[[利用者]]に提供して構いません
[SRC[>>102]]。
;; [104] しかし[[サーバー]]が [CODE(HTTP)@en[Referer:]] [[ヘッダー]]によって[[アクセス制御]]を行っていることがありますから、
まったく [CODE(HTTP)@en[Referer:]] [[ヘッダー]]を送らない[[クライアント]]は
[[Web互換]]ではありません。
* Proxy などによる削除
[197] Referer は privacy に関わる情報であることから、
これを削除する機能を持った[[串]]があります。
(本来は情報を送る [[UA]] 側で利用者が制御できるのがあるべき姿でしょうが、
そうでない UA が実際には多いですから。)
[198] しかし、ただ削除するだけなら何ら問題はないのですが、削除して代わりに
"Blocked by Proxy-name" のような文字列を挿入するものがあります。
これは[[規格違反]]であることは明らかですから、串作者はこうした文字列を入れては'''なりません'''。利用者もそのような製品はできるだけ使わず、
代替製品があればそちらを使用することが望ましいでしょう。
挿入されるいかれた文字列の例:
- [199] [SAMP(HTTP)[Field blocked by Outpost (http://www.agnitum.com)]]
- [200] [SAMP(HTTP)[Removed by Outpost <http://www.agnitum.com/>]] >>45 の方が新しい版??
[201] [SAMP(URI)[xxxx:++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]]
のように、伏字にして送ってくる糞 privacy 保護ソフトウェアがあります。
参考:
- ''Referrers Xxxx:++++++++++++++++++'' <http://www.webmasterworld.com/forum39/980.htm>
- ''xxxx:+++/ in referer logs - analog/report magic'' <http://www.webmasterworld.com/forum39/1642.htm>
- ''Get Rid Of The Turkeys Who Use'' <http://www.webmasterworld.com/forum23/2040-3-15.htm>
[SAMP(HTTP)[Blocked by [VAR[...]] ([VAR[www.example.com]])]] てなのもあるそうです。
[52] [SAMP(HTTP)[Blocked by Norton]]
こんなところでまでわざわざ自己主張しなくたってねぇ。
* [CODE(DOMi)@en[Document]] インターフェイス [CODE(DOMa)@en[referrer]] 属性
[204] [[文書]]は、[DFN[[F[[RUBYB[[[参照元]]]@en[the document's referrer]]]]]]を持ちます。
[[既定値]]は、[[空文字列]]です。 [SRC[>>91]]
[209] [[navigate]] は、作成した[[文書]]の[F[参照元]]を、
元の[[要求]]の[F[参照元]]の値に設定します。それが [CODE[no-referrer]]
だった場合には、[[空文字列]]のままとします。
[210] [[閲覧文脈の作成]]は、作成した[[文書]]の[F[参照元]]を、
[[作成子閲覧文脈]]の[[文書の番地]]に設定します。
[28] [CODE(DOMi)@en[Document]] [[インターフェイス]]の
[DFN[[CODE(DOMa)@en[referrer]]]] [[IDL属性]]は、
[[文脈オブジェクト]]の[F[参照元]]を返さなければ[MUST[なりません]] [SRC[>>205]]。
[1237] こちらは [[referer]] ではなく [[refe''rr''er]] です。
* 歴史
[109] [CITE[ncsa-mosaic/CHANGES at master · alandipert/ncsa-mosaic]]
( ([TIME[2014-04-07 05:25:37 +09:00]] 版))
<https://github.com/alandipert/ncsa-mosaic/blob/master/CHANGES#L20>
** HTTP
[FIG(quote)[
[FIGCAPTION[
[88] RFC 1945 (HTTP/1.0) 10.13; RFC 2068 (HTTP/1.1) 14.37; RFC 2616 (HTTP/1.1) 14.36 Referer
]FIGCAPTION]
>The Referer[INS[ [sic] ]] request-header field allows the client to specify,
for the server's benefit, the address (URI) of the resource from which
the Request-URI was obtained[DEL[.]] [INS[(the "referrer", although the header field is misspelled.)]] [DEL[This]] [INS[The Referer request-header]] allows a server to generate lists of back-links
to resources for interest, logging, optimized caching, etc.
It also allows obsolete or mistyped links to be traced for maintenance.
The Referer field [DEL[must not]] [INS[MUST NOT]] be sent if the Request-URI was obtained from a source
that does not have its own URI, such as input from the user keyboard.
> [CODE(HTTP)[Referer]] [おっと!]
[[要求頭欄によりクライアントはサーバーの益がために]]
Request-URI を得た資源のアドレス ([[URI]]) (「referrer」。
頭欄は綴りが間違っていますが。) を指定することが出来ます。 Referer
要求頭によりサーバーは興味, 記録, キャッシュ最適化その他の目的で資源への逆リンクの一覧を生成出来ます。
維持管理で廃止された又は綴りの間違ったリンクを追跡することも出来ます。
Referer 欄は Request-URI が URI を持たない資源,
例えば利用者の鍵盤からの入力から得たものである時には送っては'''いけません'''。
>
- Referer = "Referer" ":" ( absoluteURI | relativeURI )
> Example:
- Referer: http://www.w3.org/hypertext/DataSources/Overview.html
> If [DEL[a partial URI is given]] [INS[the field value is a [DEL[partial]] [INS[relative]] URI]], it [DEL[should]] [INS[SHOULD]] be interpreted relative to the
Request-URI. The URI [DEL[must not]] [INS[MUST NOT]] include a fragment. [INS[[INS[{2616}]] See section 15.1.3 for security considerations.]]
> 欄値が相対 URI の場合、これは Request-URI (要求 URI)
との関係であると解釈される''べき''ものです。 URI は[[素片]] (fragment)
を含んでいては'''なりません'''。安全性についての第15.1.3節も参照して下さい。
[DEL[
> [INS[{1945,2068}]] Note: Because the source of a link may be private information or
may reveal an otherwise private information source, it is strongly
recommended that the user be able to select whether or not the
Referer field is sent. For example, a browser client could have a
toggle switch for browsing openly/anonymously, which would
respectively enable/disable the sending of Referer and From information.
[INS[
注: この部分は RFC 2616 では 5.1.3 に移動しました。
]INS]
]DEL]
[INS[
注: 注記のない修正は、 RFC 1945 → RFC 2068 の変更点。
]INS]
]FIG]
[FIG(quote)[
[FIGCAPTION[
[77] RFC 1945 (HTTP/1.0) 12.4; RFC 2068 (HTTP/1.1) 15.4; RFC 2616 (HTTP/1.1) 15.1.2 (抜粋)
]FIGCAPTION]
> The Referer [DEL[field]] [INS[[INS[{2616}]] header]] allows reading patterns to be studied and reverse
links drawn. Although it can be very useful, its power can be abused
if user details are not separated from the information contained in
the Referer. Even when the personal information has been removed, the
Referer [DEL[field may]] [INS[[INS[{2616}]] header might]] indicate a private document's URI whose
publication would be inappropriate.
> [CODE(HTTP)[Referer]] 頭は、読解パターンを学習することや、
[[逆リンク]]を描くことを可能にします。これは非常に有用でありますが、
利用者の詳細が [CODE(HTTP)[Referer]] に含まれる情報から分離されていなければ、
その力は濫用され得ます。個人情報が削除されるとしても、
[CODE(HTTP)[Referer]] 頭は公表が不適切である私的な文書の URI
を示しているかもしれません。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[79] RFC 2616 (HTTP/1.1) 15.1.3 (抜粋)
]FIGCAPTION]
> Because the source of a link might be private information or might
reveal an otherwise private information source, it is strongly
recommended that the user be able to select whether or not the
Referer field is sent. For example, a browser client could have a
toggle switch for browsing openly/anonymously, which would
respectively enable/disable the sending of Referer and From information.
> リンクの始点が私的な情報であったり、本来私的な情報源を晒すことになったりするかもしれませんから、
[CODE(HTTP)[Referer]] 欄を送るかどうかを利用者が選択できるようにすることを強く推奨します。
例えば、ブラウザ・クライアントでは、公開で閲覧するか匿名で閲覧するかの切替器を用意して、
[CODE(HTTP)[Referer]] や [CODE(HTTP)[[[From]]]] の情報の送信を有効にするか無効にするか指定するようにできます。
> Clients SHOULD NOT include a Referer header field in a (non-secure)
HTTP request if the referring page was transferred with a secure protocol.
> クライアントは、参照している頁が安全なプロトコルで転送されたものであれば、
(安全でない) HTTP 要求で [CODE(HTTP)[Referer]] 頭欄を含める'''べきではありません'''。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[192] [[RTSP/1.0]] (RFC 2326 12.30 Referer)
]FIGCAPTION]
> See [H14.37]. The URL refers to that of the presentation description,
typically retrieved via HTTP.
> [H14.37] 参照。 [[URL]] は、 (典型的には HTTP を介して取り出した)
[[表現記述]]のものを参照します。
]FIG]
[116] [CITE@en[Re: History of device independence, User-Agent header?]]
( ([[Sean B. Palmer]] 著, [TIME[2014-07-15 04:46:30 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-webhistory/2014Jul/0002.html>
** [CODE(JS)@en[document.referrer]]
[206] [CODE(JS)@en[document.referrer]] は [[DOM0]] で導入されました。
[207] [[W3C]] は [[DOM1 HTML]]、[[SVG]]、[[MathML]] でこれを標準化しましたが、
なぜか [CODE(DOMi)@en[Document]] ではなく、各言語ごとの[[子インターフェイス]]の[[メンバー]]としていました。
[208] [[リンク]]を辿ってきたのではないような場合には、
HTML と SVG では空文字列に、 MathML では [CODE(DOM)[[[null]]]]
になると規定していました。
[29]
[REFS[
- [DOM 1 FE]
<http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#attribute-referrer>
- [DOM 1 SE]
<http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-95229140>
- [DOM 2] <http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-95229140>
- [MathML 2]
<http://www.w3.org/TR/MathML2/appendixd.html#dom.Document>
- [SVG 1.0]
<http://www.w3.org/TR/SVG10/struct.html#InterfaceSVGDocument>
- [SVG 1.1]
<http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGDocument>
- [1236] [CITE[Document Structure – SVG 1.1 (Second Edition)]]
( ([TIME[2011-08-10 12:35:27 +09:00]] 版))
<http://www.w3.org/TR/2011/REC-SVG11-20110816/struct.html#__svg__SVGDocument__referrer>
- [35]
<http://www.microsoft.com/japan/msdn/library/ja/jpisdk/dhtml/references/properties/referrer.asp?FRAME=true#referrer>
- [36]
''referrer Property (document) (Internet Explorer)'' <http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/referrer.asp>
]REFS]
[1240] [CITE[Document Object Model for MathML]]
( ([TIME[2001-02-20 21:36:10 +09:00]] 版))
<http://www.w3.org/TR/2001/REC-MathML2-20010221/appendixd.html#dom_Document>
[1241] [CITE[Document Object Model for MathML]]
( ([TIME[2002-05-23 15:35:03 +09:00]] 版))
<http://www.w3.org/Math/DOM/mathml2/appendixd.html#dom_Document>
** 00年代の実装
[78] [[Mozilla]] では、 View->Page Info->General->Referring URL に Referer
として送られた URI が出ます。
[193] [[Apache]] の log では、既定では、 [SAMP["[VAR[http://www.example.com/]]"]] のように記録されますが、
[CODE(HTTP)[Referer:]] 欄自体が送られてこなかったときには
[SAMP["-"]] になります。
空 (または空白だけ) の [CODE(HTTP)[Referer:]] 欄が送られてきたときには、
[SAMP[""]] になります。
[CODE(HTTP)[Referer: -]] が送られてきたら、
[SAMP["-"]] になりました。
[53] Referer リクエストヘッダの除去 <http://www.st.ryukoku.ac.jp/~kjm/security/memo/referer.html>
[194] 2002-11-04 (月) 13:45 ''[[Name_Not_Found]]'' [[InternetExplorer]] で現時点で Referer をつけない方法はありません。代わりに >>197 のような串を使うのが良いでしょう。
[195] >>194 少々面倒ですが、リンクを[RUBY[鼠] [マウス]]で[RUBY[引っ張っ] [ドラッグし]]て、「アドレス」欄などに[RUBY[落と] [ドロップ]]したら
Referer は送られません。
この方法は[[Mozilla]] でも、タブの上に drag & drop とかすれば使えます。普段は Referer を送るけど、特定の場合には送らないというのに便利。
[196] [WEAK[2002-12-25 11:53]] ''>>195'': でも Mozilla 1.2.1 でそれやったら残ったことがあった。残らないこともあった。変だなあ
** HTML5
[129] [CITE@en[(X)HTML5 Tracking]]
([TIME[2009-10-25 17:13:49 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4328&to=4329>
[103] [CITE@en[HTML5 Revision Tracker]]
([TIME[2010-02-14 20:31:47 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4726&to=4727>
[104] [CITE@en[HTML5 Revision Tracker]]
([TIME[2010-02-14 20:31:47 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4726&to=4727>
[130] [CITE[Request Headers in the HTTP protocol]]
( ([TIME[2001-11-29 11:01:38 +09:00]] 版))
<http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14>
[106] [CITE[141641 – disabling cross-site HTTPS referrers breaks sites ''''''[''''''was: when leaving https, should send host+port as referrer instead of no referer'''''']'''''']]
( ([TIME[2012-03-25 11:23:08 +09:00]] 版))
<https://bugzilla.mozilla.org/show_bug.cgi?id=141641>
[131] [CITE@en[Web Applications 1.0 r7341 Attempt to actually define what Referer headers are used for a whole host of things that were poorly defined. Also: cleanup of a bunch of editorial mistakes I found from past such attempts. Mark every fetch algorithm use for sanity in the future. Block data:, javascript:, and about:blank referrers. Note: This relies on not-yet-done changes to CORS and XHR.]]
( ([TIME[2012-09-13 08:14:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7340&to=7341>
[108] [CITE[IRC logs: freenode / #whatwg / 20120912]]
( ([TIME[2012-09-14 23:56:43 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20120912>
[120] [CITE@en[Web Applications 1.0 r8791 Make appcache requests have no referrer, since it's not clear what referrer to use.]]
( ([TIME[2014-09-20 02:52:00 +09:00]] 版))
<https://html5.org/r/8791>
** [CODE(HTML)@en[<meta name=referrer>]]
[1238] [CITE[''''''[''''''whatwg'''''']'''''' <meta name="referrer">]]
( ([TIME[2011-10-26 08:31:13 +09:00]] 版))
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-October/033617.html>
[1239] [CITE@en[Meta referrer - WHATWG Wiki]]
( ([TIME[2011-10-26 08:13:15 +09:00]] 版))
<http://wiki.whatwg.org/wiki/Meta_referrer>
** CSP
[1246] [CITE[Bug 61576 – Consider adding "scrub-referrer" directive to CSP]]
( ([TIME[2013-10-13 02:12:25 +09:00]] 版))
<https://bugs.webkit.org/show_bug.cgi?id=61576>
[1247] [CITE@en[Content Security Policy 1.1]] ([TIME[2013-10-13 02:14:40 +09:00]] 版) <https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#referrer>
[1248] [CITE[restrict-referrer-leakage.txt on Ticket #127 – Attachment – tahoe-lafs]]
( ([TIME[2013-10-13 02:50:58 +09:00]] 版))
<https://tahoe-lafs.org/trac/tahoe-lafs/attachment/ticket/127/restrict-referrer-leakage.txt>
[1249] [CITE@en[Privacy/Features/Shortened HTTP Referer header - MozillaWiki]]
( ([TIME[2013-08-10 14:11:55 +09:00]] 版))
<https://wiki.mozilla.org/Privacy/Features/Shortened_HTTP_Referer_header>
[1250] [CITE@ja[Protecting Privacy with Referrers]]
( ([TIME[2013-10-13 02:52:44 +09:00]] 版))
<http://www.facebook.com/notes/facebook-engineering/protecting-privacy-with-referrers/392382738919>
[1251] [CITE@en[''''''[''''''whatwg'''''']'''''' Feedback on Meta referrer]]
( ([[Adam Barth]] 著, [TIME[2012-01-26 18:48:18 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Jan/0243.html>
[1252] [CITE@en[ISSUE-39: Discuss CSP relevant use cases for possibly including Meta Referrer as a CSP directive - Web Application Security Working Group Tracker]]
( ([TIME[2013-10-13 03:01:35 +09:00]] 版))
<http://www.w3.org/2011/webappsec/track/issues/39>
[1253] [CITE@en[scrub-referrer directive?]]
( ([[Adam Barth]] 著, [TIME[2011-05-27 09:04:11 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-web-security/2011May/0001.html>
[1254] [CITE[Issue 309551 - chromium - CSP 1.1: Implement 'referrer' directive. - An open-source project to help move the web forward. - Google Project Hosting]]
( ([TIME[2014-03-19 04:51:18 +09:00]] 版))
<https://code.google.com/p/chromium/issues/detail?id=309551>
[1255] [CITE@en[Bug 25973 – CORS preflight referrer header.]]
( ([TIME[2014-06-13 15:12:45 +09:00]] 版))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=25973>
[1256] [CITE[Put in Referrer Policy hook link · d5fc282 · whatwg/fetch]]
( ([TIME[2014-06-16 03:06:11 +09:00]] 版))
<https://github.com/whatwg/fetch/commit/d5fc28228d0842680e3a33a8c1a7d215315d13ef>
[117] [CITE@en[''''''[''''''REFERRER'''''']'''''' Where does "Determine request’s Referrer" get its URL from?]]
( ([[Ian Hickson]] 著, [TIME[2014-07-24 05:14:13 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-webappsec/2014Jul/0101.html>
[118] [CITE@en[Referrer Policy]]
( ([TIME[2014-08-05 22:32:51 +09:00]] 版))
<http://www.w3.org/TR/2014/WD-referrer-policy-20140807/>
[119] [CITE@en[CSP2: Delegate definition of 'referrer' to Referrer Policy. · d5483ae · w3c/webappsec]]
( ([TIME[2014-08-19 08:17:59 +09:00]] 版))
<https://github.com/w3c/webappsec/commit/d5483ae3cb199798cdd44d5c85c2482e7f992501>
[121] [CITE@en[REFERRER: Ignore empty strings. · 58d5d78 · w3c/webappsec]]
( ([TIME[2014-10-21 09:50:55 +09:00]] 版))
<https://github.com/w3c/webappsec/commit/58d5d7841d31f8e16fdde63da56cc9b08efadf13>
[122] [CITE@en[REFERRER: Ignore case when evaluating tokens. · 0a26369 · w3c/webappsec]]
( ([TIME[2014-10-21 09:52:40 +09:00]] 版))
<https://github.com/w3c/webappsec/commit/0a263697170b88524c0be685a54f16711a6a0e14>
[123] [CITE@en[REFERRER: Be a bit more specific about case-insensitivity. · a30ed4e · w3c/webappsec]]
( ([TIME[2014-10-21 09:53:41 +09:00]] 版))
<https://github.com/w3c/webappsec/commit/a30ed4e5cded7f42bd5f5dfc65a194587f54ccd6>
[8] [CITE@en[Referrer attribute · Issue #409 · w3c/webappsec]]
([TIME[2015-07-07 11:01:12 +09:00]] 版)
<https://github.com/w3c/webappsec/issues/409>
[21] [CITE@en[Referrer and cross-origin CSS · Issue #413 · w3c/webappsec]]
([TIME[2015-07-07 11:01:34 +09:00]] 版)
<https://github.com/w3c/webappsec/issues/413>
;; [40] [CODE(HTTP)@en[Referrer-Policy:]] も参照。
** URL 規定の整理
[1242] [CITE@en[Web Applications 1.0 r7710 Integrate with URL standard.]]
( ([TIME[2013-02-09 11:07:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7709&to=7710>
[1243] [CITE@en[Web Applications 1.0 r7762 I totally broke document.referrer a few weeks ago.]]
( ([TIME[2013-03-22 03:22:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7761&to=7762>
[1244] [CITE[''''''[''''''whatwg'''''']'''''' Question about document.referrer (and document.URL, document.location.href) when IDN domains are in use]]
( ([TIME[2013-07-13 07:02:52 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/040031.html>
[1245] [CITE[''''''[''''''whatwg'''''']'''''' Question about document.referrer (and document.URL, document.location.href) when IDN domains are in use]]
( ([TIME[2013-09-10 23:02:32 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-September/040748.html>
[124] [CITE@en[Web Applications 1.0 r8848 fix a mess I made with 'referrer source' recently]]
( ([TIME[2014-11-13 04:34:00 +09:00]] 版))
<https://html5.org/r/8848>
[125] [CITE@en[Web Applications 1.0 r8853 Drop the 'responsible document' concept. This also changes the referrer to use when launching a nested worker to be the URL of the outer worker instead of the URL of the outer Document, which made no sense really.]]
( ([TIME[2014-11-20 08:35:00 +09:00]] 版))
<https://html5.org/r/8853>
[6] [CITE@en[Fix the order of CSP, HSTS, Mixed Content, and Referrer https://www.w3.o... · b8c2c49 · whatwg/fetch]]
([TIME[2015-01-28 18:20:57 +09:00]] 版)
<https://github.com/whatwg/fetch/commit/b8c2c4964c233cd3616042c04e2c14e0ff25485d>
[25] [CITE@en[Integrate Fetch into HTML · whatwg/html@7c5555a]]
([TIME[2015-09-18 18:50:58 +09:00]] 版)
<https://github.com/whatwg/html/commit/7c5555a16f2920c02244c10756bb2f1a11e87a22>
[26] [CITE@en[Never send a referrer with hyperlink auditing pings · whatwg/html@faec3a5]]
([TIME[2016-02-23 11:01:52 +09:00]] 版)
<https://github.com/whatwg/html/commit/faec3a50ea181f322ab9819975e285ced34a0308>
[27] [CITE@en[Use USVString for document.domain/referrer/cookie · whatwg/html@8170d82]]
([TIME[2016-04-05 13:59:56 +09:00]] 版)
<https://github.com/whatwg/html/commit/8170d82a2fc93c8ff7981c54aa4ccafd54204552>
* メモ
[62]
ここのように頁の名前に[Q[Referer]]が入っていると referer spamer を引き寄せることができるようですね(w
([[名無しさん]] [WEAK[2005-01-31 08:26:42 +00:00]])
[64]
'''どのURI参照を Referer とするか''':
[[HTML]] の [CODE(HTMLe)[[[a]]]] や
[CODE(HTMLe)[[[img]]]] のような単純なリンクが単純に存在する場合は Referer
となるべき URI 参照は自明 (その[[文書実体]]の URI 参照) ですが、
[[取込み]]や[[輸入]]が複雑に絡むと何を送るべきかわからなくなることがあります。
例:
- 外部 [[CSS]] [[スタイル・シート]]から参照された画像
-- スタイル・シートの URI 参照を使うのが自然に思えます
-- 利用者エージェントによっては文書の URI 参照を使います
- 外部スクリプトから [[DOM]] によって
[CODE(HTMLe)[[[img]]]] [CODE(HTMLa)[[[src]]]] に URI 参照を設定することによるリンク
-- 意味的に[Q[参照]]しているのは、
もしかすると外部スクリプトかもしれません。
-- 実際に画像を参照しているのは、
[CODE(HTMLe)[img]] 要素が含まれている文書です。
-- ただし元々の文書にはその画像への参照は存在していませんでした。
静的に存在していない参照の参照元とみなされるのは奇妙に思えるかもしれません。
-- なお、技術的に、 [CODE(HTMLa)[src]]
属性を指定したスクリプトの URI 参照を何らかの手段で覚えておくというのは厄介なことが多そうです。
-- 動的な参照なら Referer なしにする、というのも一つの解かもしれません。
- [[外部解析対象実体]]の中の [[XLink]] による参照
-- 外部解析対象実体内の要素の[[基底URI]]
は保存されます [SRC[[[XML情報集合]]]]。
実体自身の URI 参照も保存するという実装にしても悪くはないでしょう。
-- 仮に保存したとして、 [[DOM]]
などによる操作で他の場所に移したりしたら、それでもその URI 参照は保存されているべきでしょうか?
- [[XInclude]] で取込んだ部分の中にある参照
- [[XSLT]] [[結果木]]にある参照
-- XSLT による変換結果は、元の文書と同じではありません。
元の文書の URI 参照を Referer としてもよいのでしょうか?
-- 参照は元の文書に存在して、それを変換したものであるかもしれませんし、
元の文書には存在せず、 XSLT
スタイル・シートによって補われたものかもしれません。
- [[C]] の[[前処理]]のような参照によって生じた参照
([[名無しさん]])
[126] 各々の書式の処理モデルにおいて、参照を解釈した結果[Q[溶け込]]んでしまった部分は区別せずに (区別できずに) 参照元の一部であったかのように扱い、参照を解釈しても元々の区別が保存され続ける場合には外部から取込んだ部分の元の URI 参照を保存しておくのが、
実装的には一番楽な方法であると思われます。
しかし、前述のように、動的に作られる参照は非直感的なことがあり得るなど、
問題が無いわけではありません。
ある URI 参照が何を意味しているのかという根本的な問題にも関係してきます。
[100]
[CITE@ja-JP[高木浩光@自宅の日記 - Refererを誤送信するブラウザが最近も存在する, 栃木県警の無断リンク禁止規定の復活はシステム不具合による事故]] ([[高木浩光]] 著, [TIME[2007-07-07 22:41:18 +09:00]] 版) <http://takagi-hiromitsu.jp/diary/20070707.html#p01>