LocationヘッダのURIにフラグメント識別子はNG
Location時にフラグメント識別子を付けられるのか?
d:id:maru_cc:20080207:1202385497
こちらがRFC的にどうなっているのか調べてみた。
確信は持てないがおそらく、RFC的にNGということでいいのかな?
まず、#XXXと書くのの正式名称がわからなかったので調査。
http://www.7key.jp/rfc/2396/rfc2396_4.html#li28
4.1. Fragment Identifier
URI参照が識別されたリソースの取得動作を行う際、URIを"#"で区切ることによってフラグメント識別子を任意で付けることができる。フラグメント識別子は、リソースの取得動作が成功した後にユーザエージェントが解釈する付加的な参照情報である。このため、フラグメント識別子はURIではないが、 URIと共に用いられることが少なくない。
フラグメント識別子と言うらしい。
http://lab.moyo.biz/translations/rfc/rfc2616-ja.txt
14.30 Location
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the
request or identification of a new resource. For 201 (Created)
responses, the Location is that of the new resource which was created
by the request. For 3xx responses, the location SHOULD indicate the
server's preferred URI for automatic redirection to the resource. The
field value consists of a single absolute URI.Location = "Location" ":" absoluteURI
An example is:
Location: http://www.w3.org/pub/WWW/People.html
Note: The Content-Location header field (section 14.14) differs
from Location in that the Content-Location identifies the original
location of the entity enclosed in the request. It is therefore
possible for a response to contain header fields for both Location
and Content-Location. Also see section 13.10 for cache
requirements of some methods.
日本語訳
http://www.studyinghttp.net/header#Location
absoluteURIとはなんぞや?
http://suika.fam.cx/~wakaba/-temp/wiki/wiki?absoluteURI
absoluteURI := scheme ":" ( hier_part / opaque_part ) ;; RFC 2396
RFC 2396をあさる
ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt
absoluteURI = scheme ":" ( hier_part | opaque_part )
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
URI-referenceで明確に absoluteURI + #fragment と書いてあることから、どうやらLocationヘッダのURIにはフラグメント識別子は付けられないというのがRFC的な仕様ということだろうか。