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

查看:20
本文介绍了HTTP 标头字段“Content-Location"的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对我的问题的评论感到困惑/启发 搜索引擎是否尊重 HTTP 标头字段Content-Location"?,我想知道 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://www.rfc-editor.org/rfc/rfc7234#section-4.4 and https://www.rfc-editor.org/rfc/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://www.rfc-editor.org/rfc/rfc7231#section-3.1.4.2) Note that Firefox and Chrome do not appear to implement this.

这篇关于HTTP 标头字段“Content-Location"的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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