web-dev-qa-db-ja.com

301リダイレクトは常にリファラーを保持しますか?

301リダイレクトが常にリファラーを保持するかどうかを知りたいです。

ページ「orig_https.asp」へのハイパーリンクを含む「gotoorig_https.html」というページを作成します。
"orig_https.asp"は、document.referrerを表示する "dest.html"に301リダイレクトします。

この場合、

http page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  
https page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  

また、ページ「orig_http.asp」へのハイパーリンクを含む「gotoorig_http.html」というページを作成します。 「orig_http.asp」は、document.referrerを表示する「dest.html」に301リダイレクトします。

この場合、

http page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer preserves  
https page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer DOES NOT preserve.

なぜ最後のケースが発生するのですか?

26
Billy

RFCは、ステータス301定義でのリファラー固有の動作も、Refererヘッダー定義での301固有の動作も指定していません。したがって、このリファラーを保持する動作は論理的ですが、RFCで定義されていないため、確信が持てないことを言わなければなりません。

28
Michał Górny

HTTPとHTTPSの間を行き来するとき、HTTP仕様は、リファラーヘッダーを送信してはならないと言っています( RFC2616 の15.1.3を参照)。ただし、この仕様では、HTTPSページ間で何が発生するかについては規定されていません。

興味深いことに、この場合、Firefoxはデフォルトで仕様を無視しますが、network.http.sendSecureXSiteReferrer構成設定を設定することで準拠させることができます。

12
blowdart