aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/http/headers/cache-control/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pl/web/http/headers/cache-control/index.html')
-rw-r--r--files/pl/web/http/headers/cache-control/index.html171
1 files changed, 171 insertions, 0 deletions
diff --git a/files/pl/web/http/headers/cache-control/index.html b/files/pl/web/http/headers/cache-control/index.html
new file mode 100644
index 0000000000..8ce8eb1f63
--- /dev/null
+++ b/files/pl/web/http/headers/cache-control/index.html
@@ -0,0 +1,171 @@
+---
+title: Cache-Control
+slug: Web/HTTP/Headers/Cache-Control
+translation_of: Web/HTTP/Headers/Cache-Control
+---
+<div>{{HTTPSidebar}}</div>
+
+<p><strong><code>Cache-Control</code></strong> nagłówek jest stosowany do określania dyrektyw sterujących pamięcią podręczną w zapytaniu i odpowiedzi protokołu HTTP. Dyrektywy pamięci podręcznej są jednokierunkowe, co oznacza że dyrektywa użyta w zapytaniu klienta HTTP nie musi pojawić się w odpowiedzi serwera.</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Header type</th>
+ <td>{{Glossary("General header")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Forbidden header name")}}</th>
+ <td>no</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Simple response header", "CORS-safelisted response-header")}}</th>
+ <td>yes</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Składnia">Składnia</h2>
+
+<p>Wielkość liter nie ma znaczeniu w określaniu dyrektyw. Dyrektywa może posiadać opcjonalny argument który może być podany jako token (słowo) lub string w cudzysłowiu. Możliwe jest podanie wielu dyrektyw przez oddzielenie ich przecinkiem.</p>
+
+<h3 id="Dyrektywy_zapytania">Dyrektywy zapytania</h3>
+
+<p>Standardowe dyrektywy nagłówka <code>Cache-Control</code> które mogą być użyte w zapytaniu klienta HTTP.</p>
+
+<pre class="syntaxbox">Cache-Control: max-age=&lt;seconds&gt;
+Cache-Control: max-stale[=&lt;seconds&gt;]
+Cache-Control: min-fresh=&lt;seconds&gt;
+Cache-Control: no-cache
+Cache-Control: no-store
+Cache-Control: no-transform
+Cache-Control: only-if-cached
+</pre>
+
+<h3 id="Dyrektywy_odpowiedzi">Dyrektywy odpowiedzi</h3>
+
+<p>Standardowe dyrektywy nagłówka <code>Cache-Control</code> które mogą być użyte w odpowiedzi serwera HTTP.</p>
+
+<pre class="syntaxbox">Cache-Control: must-revalidate
+Cache-Control: no-cache
+Cache-Control: no-store
+Cache-Control: no-transform
+Cache-Control: public
+Cache-Control: private
+Cache-Control: proxy-revalidate
+Cache-Control: max-age=&lt;seconds&gt;
+Cache-Control: s-maxage=&lt;seconds&gt;
+</pre>
+
+<h3 id="Extension_Cache-Control_directives">Extension <code>Cache-Control</code> directives</h3>
+
+<p>Extension <code>Cache-Control</code> directives are not part of the core HTTP caching standards document. Be sure to check the <a href="#Browser_compatibility">compatibility table</a> for their support.</p>
+
+<pre class="syntaxbox">Cache-Control: immutable
+Cache-Control: stale-while-revalidate=&lt;seconds&gt;
+Cache-Control: stale-if-error=&lt;seconds&gt;
+</pre>
+
+<h2 id="Directives">Directives</h2>
+
+<h3 id="Cacheability">Cacheability</h3>
+
+<dl>
+ <dt><code>public</code></dt>
+ <dd>Indicates that the response may be cached by any cache.</dd>
+ <dt><code>private</code></dt>
+ <dd>Indicates that the response is intended for a single user and must not be stored by a shared cache. A private cache may store the response.</dd>
+ <dt><code>no-cache</code></dt>
+ <dd>Forces caches to submit the request to the origin server for validation before releasing a cached copy.</dd>
+ <dt><code>only-if-cached</code></dt>
+ <dd>Indicates to not retrieve new data. This being the case, the server wishes the client to obtain a response only once and then cache. From this moment the client should keep releasing a cached copy and avoid contacting the origin-server to see if a newer copy exists.</dd>
+</dl>
+
+<h3 id="Expiration">Expiration</h3>
+
+<dl>
+ <dt><code>max-age=&lt;seconds&gt;</code></dt>
+ <dd>Specifies the maximum amount of time a resource will be considered fresh. Contrary to <code>Expires</code>, this directive is relative to the time of the request.</dd>
+ <dt><code>s-maxage=&lt;seconds&gt;</code></dt>
+ <dd>Overrides <code>max-age</code> or the <code>Expires</code> header, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.</dd>
+ <dt><code>max-stale[=&lt;seconds&gt;]</code></dt>
+ <dd>Indicates that the client is willing to accept a response that has exceeded its expiration time. Optionally, you can assign a value in seconds, indicating the time the response must not be expired by.</dd>
+ <dt><code>min-fresh=&lt;seconds&gt;</code></dt>
+ <dd>Indicates that the client wants a response that will still be fresh for at least the specified number of seconds.</dd>
+ <dt><code>stale-while-revalidate=&lt;seconds&gt;</code> {{experimental_inline}}</dt>
+ <dd>Indicates that the client is willing to accept a stale response while asynchronously checking in the background for a fresh one. The seconds value indicates for how long the client is willing to accept a stale response.</dd>
+ <dt><code>stale-if-error=&lt;seconds&gt;</code> {{experimental_inline}}</dt>
+ <dd>Indicates that the client is willing to accept a stale response if the check for a fresh one fails. The seconds value indicates for how long the client is willing to accept the stale response after the initial expiration.</dd>
+</dl>
+
+<h3 id="Revalidation_and_reloading">Revalidation and reloading</h3>
+
+<dl>
+ <dt><code>must-revalidate</code></dt>
+ <dd>The cache must verify the status of the stale resources before using it and expired ones should not be used.</dd>
+ <dt><code>proxy-revalidate</code></dt>
+ <dd>Same as <code>must-revalidate</code>, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.</dd>
+ <dt><code>immutable</code></dt>
+ <dd>Indicates that the response body will not change over time. The resource, if unexpired, is unchanged on the server and therefore the client should not send a conditional revalidation for it (e.g. <code>If-None-Match</code> or <code>If-Modified-Since</code>) to check for updates, even when the user explicitly refreshes the page. Clients that aren't aware of this extension must ignore them as per the HTTP specification. In Firefox, <code>immutable</code> is only honored on <code>https://</code> transactions. For more information, see also this <a href="http://bitsup.blogspot.de/2016/05/cache-control-immutable.html">blog post</a>.</dd>
+</dl>
+
+<h3 id="Other">Other</h3>
+
+<dl>
+ <dt><code>no-store</code></dt>
+ <dd>The cache should not store anything about the client request or server response.</dd>
+ <dt><code>no-transform</code></dt>
+ <dd>No transformations or conversions should be made to the resource. The Content-Encoding, Content-Range, Content-Type headers must not be modified by a proxy. A non- transparent proxy might, for example, convert between image formats in order to save cache space or to reduce the amount of traffic on a slow link. The <code>no-transform</code> directive disallows this.</dd>
+</dl>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Preventing_caching">Preventing caching</h3>
+
+<p>To turn off caching, you can send the following response header. In addition, see also the <code>Expires</code> and <code>Pragma</code> headers.</p>
+
+<pre class="brush: bash">Cache-Control: no-cache, no-store, must-revalidate
+</pre>
+
+<h3 id="Caching_static_assets">Caching static assets</h3>
+
+<p>For the files in the application that will not change, you can usually add aggressive caching by sending the response header below. This includes static files that are served by the application such as images, CSS files and JavaScript files, for example. In addition, see also the <code>Expires</code> header.</p>
+
+<pre class="brush: bash">Cache-Control: public, max-age=31536000</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("7234")}}</td>
+ <td>Hypertext Transfer Protocol (HTTP/1.1): Caching</td>
+ </tr>
+ <tr>
+ <td>{{RFC("5861")}}</td>
+ <td>HTTP Cache-Control Extensions for Stale Content</td>
+ </tr>
+ <tr>
+ <td>{{RFC("8246")}}</td>
+ <td>HTTP Immutable Responses</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.Cache-Control")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/HTTP/Caching_FAQ">HTTP Caching FAQ</a></li>
+ <li>{{HTTPHeader("Age")}}</li>
+ <li>{{HTTPHeader("Expires")}}</li>
+ <li>{{HTTPHeader("Pragma")}}</li>
+</ul>