--- title: Referer slug: Web/HTTP/Headers/Referer tags: - HTTP - HTTP リクエストヘッダー - Reference - referer - ヘッダー - リクエストヘッダー - リファラー translation_of: Web/HTTP/Headers/Referer --- <div>{{HTTPSidebar}}</div> <p><code><strong>Referer</strong></code> リクエストヘッダーには、現在リクエストされているページへのリンク先を持った直前のウェブページのアドレスが含まれています。 <code>Referer</code> ヘッダーにより、サーバーは人々がどこから訪問しに来たかを識別し、分析、ログ、キャッシュの最適化などに利用することができます。</p> <div class="warning"> <p><strong>重要</strong>: このヘッダーには無害な用途が多数ありますが、ユーザーのセキュリティとプライバシーに望ましくない結果をもたらす可能性もあります。 詳細情報と緩和策については <a href="/ja/docs/Web/Security/Referer_header:_privacy_and_security_concerns">Referer header: privacy and security concerns</a> を参照してください。</p> </div> <p>なお、 referer は実際には "referrer" という単語のスペルミスです。詳しくは {{interwiki("wikipedia", "HTTPリファラ", "Wikipedia の HTTP リファラ")}}を参照してください。</p> <p>次のような場合は、ブラウザーは <code>Referer</code> ヘッダーを送信しません。</p> <ul> <li>参照していたリソースがローカルの "file" または "data" の URI の場合</li> <li>安全ではない HTTP リクエストが使用されており、それを参照しているページが安全なプロトコル (HTTPS) で受信された場合</li> </ul> <table class="properties"> <tbody> <tr> <th scope="row">ヘッダー種別</th> <td>{{Glossary("Request header", "リクエストヘッダー")}}</td> </tr> <tr> <th scope="row">{{Glossary("Forbidden header name", "禁止ヘッダー名")}}</th> <td>はい</td> </tr> </tbody> </table> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="syntaxbox">Referer: <url> </pre> <h2 id="Directives" name="Directives">ディレクティブ</h2> <dl> <dt><url></dt> <dd>現在リクエスト中のページにつながるリンクがある直前のページの、絶対または相対アドレスです。 URL フラグメント (つまり "#section") およびユーザー情報 ("https://username:password@example.com/foo/bar/" の "username:password" の部分) は含まれません。リファラーポリシーによっては、オリジン、パス、クエリ文字列が含まれる場合があります。</dd> </dl> <h2 id="Examples" name="Examples">例</h2> <pre>Referer: https://developer.mozilla.org/en-US/docs/Web/JavaScript Referer: https://example.com/page?q=123 Referer: https://example.com/ </pre> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様書</th> <th scope="col">題名</th> </tr> </thead> <tbody> <tr> <td>{{RFC("7231", "Referer", "5.5.2")}}</td> <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("http.headers.Referer")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li>{{interwiki("wikipedia", "HTTP_referer", "HTTP referer on Wikipedia")}}</li> <li>{{HTTPHeader("Referrer-Policy")}}</li> </ul>