HTTP头字段“Content-Location”的目的是什么? [英] What is the purpose of the HTTP header field “Content-Location”?
问题描述
对我的问题的评论感到困惑/启发搜索引擎是否尊重HTTP标题字段Content-Location?,我想知道, 内容 - 位置
HTTP中的标题字段以及如何使用它。
Confused/inspired by a comment to my question Do search engines respect the HTTP header field "Content-Location"?, I’d like to know, what the exact purpose of the Content-Location
header field in HTTP is and how it can be used.
推荐答案
为了响应GET请求,当请求的资源有多个可用表示时,可以使用HTTP中的Content-Location,例如多种语言。返回的资源选择取决于原始GET请求中的Accept标头。
In response to a GET request, Content-Location in HTTP can be used when a requested resource has multiple representations available, e.g. multiple languages. The selection of the resource returned will depend on the Accept headers in the original GET request.
通常,Content-Location标头中指定的位置与指定的位置不同在原始请求的URI中。
Usually, the location specified in the Content-Location header is different to the location specified in the original request's URI.
在响应PUT或POST请求时,
In response to a PUT or POST request,
- 如果Content-Location URI与请求的URI不同,则指示的URI处的高速缓存条目无效。 (参见 https://tools.ietf.org/html/rfc7234#section-4.4 和 https://tools.ietf.org/html/rfc2616#section- 13.10 )
- 如果Content-Location URI与请求的URI相同,则表示缓存对PUT / POST请求的响应与响应将在同一位置由200响应GET请求接收,因此可以缓存。 (参见 https://tools.ietf.org/html/rfc7231#section- 3.1.4.2 )请注意,Firefox和Chrome似乎没有实现这一点。
- If the Content-Location URI is different than the requested URI, then the cache entry at the indicated URI is invalidated. (see https://tools.ietf.org/html/rfc7234#section-4.4 and https://tools.ietf.org/html/rfc2616#section-13.10)
- If the Content-Location URI is the same as the requested URI, then that indicates to caches that the response to the PUT/POST request is the same as the response that would be received by a 200 response to a GET request at the same location and can thus be cached. (see https://tools.ietf.org/html/rfc7231#section-3.1.4.2) Note that Firefox and Chrome do not appear to implement this.
这篇关于HTTP头字段“Content-Location”的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!