HTTP头字段“Content-Location”的目的是什么? [英] What is the purpose of the HTTP header field “Content-Location”?

查看:479
本文介绍了HTTP头字段“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,

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆