aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/http/headers/vary/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ru/web/http/headers/vary/index.html')
-rw-r--r--files/ru/web/http/headers/vary/index.html81
1 files changed, 81 insertions, 0 deletions
diff --git a/files/ru/web/http/headers/vary/index.html b/files/ru/web/http/headers/vary/index.html
new file mode 100644
index 0000000000..a9bf3238e6
--- /dev/null
+++ b/files/ru/web/http/headers/vary/index.html
@@ -0,0 +1,81 @@
+---
+title: Vary
+slug: Web/HTTP/Заголовки/Vary
+translation_of: Web/HTTP/Headers/Vary
+---
+<div>{{HTTPSidebar}}</div>
+
+<p>Заголовок ответа <strong><code>Vary</code></strong> определяет, как сопоставить будущие заголовки запроса, чтобы решить, можно ли использовать кэшированный ответ, а не запрашивать новый с исходного сервера. Он используется сервером для указания того, какие заголовки он использовал при выборе представления ресурса в <a href="/en-US/docs/Web/HTTP/Content_negotiation">алгоритме согласования</a> контента.</p>
+
+<p>Заголовок <code>Vary</code> должен быть установлен для ответа {{HTTPStatus("304")}} <code>Not Modified</code> точно так же, как он был бы установлен для эквивалентного ответа {{HTTPStatus("200")}} <code>OK</code>.</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Тип заголовка</th>
+ <td>{{Glossary("Response header")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Forbidden header name")}}</th>
+ <td>no</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">Vary: *
+Vary: &lt;header-name&gt;, &lt;header-name&gt;, ...
+</pre>
+
+<h2 id="Directives">Directives</h2>
+
+<dl>
+ <dt>*</dt>
+ <dd>Каждый запрос должен рассматриваться как уникальный и не кэшируемый. Лучший способ указать это - использовать {{HTTPHeader ("Cache-Control")}}: <code>no-store</code>, который удобнее для чтения и также сигнализирует о том, что объект не должен храниться никогда.</dd>
+ <dt>&lt;header-name&gt;</dt>
+ <dd>Разделенный запятыми список имен заголовков, которые необходимо учитывать при принятии решения о том, можно ли использовать кэшированный ответ.</dd>
+</dl>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Dynamic_serving">Dynamic serving</h3>
+
+<p>When using the <code>Vary: User-Agent</code> header, caching servers should consider the user agent when deciding whether to serve the page from cache. For example, if you are serving different content to mobile users, it can help you to avoid that a cache may mistakenly serve a desktop version of your site to your mobile users. It can help Google and other search engines to discover the mobile version of a page, and might also tell them that no <a href="https://en.wikipedia.org/wiki/Cloaking">Cloaking</a> is intended.</p>
+
+<pre>Vary: User-Agent</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Title</th>
+ </tr>
+ <tr>
+ <td>{{RFC("7231", "Vary", "7.1.4")}}</td>
+ <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("http.headers.Vary")}}</p>
+
+<h2 id="Compatibility_notes">Compatibility notes</h2>
+
+<ul>
+ <li><a href="https://blogs.msdn.microsoft.com/ieinternals/2009/06/17/vary-with-care/">Vary with care – Vary header problems in IE6-9</a></li>
+</ul>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="https://www.smashingmagazine.com/2017/11/understanding-vary-header/">Understanding The Vary Header - Smashing Magazine</a></li>
+ <li><a href="https://www.fastly.com/blog/best-practices-for-using-the-vary-header">Best Practices for Using the Vary Header – fastly.com</a></li>
+ <li><a href="https://developer.mozilla.org/docs/Web/HTTP/Content_negotiation">Content negotiation</a></li>
+</ul>