Mercurial > hg > nginx-site
view xml/en/docs/http/ngx_http_headers_module.xml @ 744:ac709e45740d
Revision of ngx_http_gunzip_module documentation.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 23 Oct 2012 14:45:14 +0000 |
parents | f368bff5c70a |
children | 3974a50b2142 |
line wrap: on
line source
<?xml version="1.0"?> <!-- Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> <module name="Module ngx_http_headers_module" link="/en/docs/http/ngx_http_headers_module.html" lang="en" rev="2"> <section id="summary"> <para> The <literal>ngx_http_headers_module</literal> module allows to emit the <header>Expires</header> and <header>Cache-Control</header> header fields, and to add arbitrary fields to a response header. </para> </section> <section id="example" name="Example Configuration"> <para> <example> expires 24h; expires modified +24h; expires @24h; expires 0; expires -1; expires epoch; add_header Cache-Control private; </example> </para> </section> <section id="directives" name="Directives"> <directive name="add_header"> <syntax><value>name</value> <value>value</value></syntax> <default/> <context>http</context> <context>server</context> <context>location</context> <context>if in location</context> <para> Adds the specified field to a response header provided that the response code equals 200, 204, 206, 301, 302, 303, 304, or 307. A value can contain variables. </para> </directive> <directive name="expires"> <syntax>[<literal>modified</literal>] <value>time</value></syntax> <syntax> <literal>epoch</literal> | <literal>max</literal> | <literal>off</literal></syntax> <default>off</default> <context>http</context> <context>server</context> <context>location</context> <context>if in location</context> <para> Enables or disables adding or modifying the <header>Expires</header> and <header>Cache-Control</header> response header fields. A parameter can be a positive or negative <link doc="../syntax.xml">time</link>. </para> <para> A time in the <header>Expires</header> field is computed as a sum of the current time and <value>time</value> specified in the directive. If the <literal>modified</literal> parameter is used (0.7.0, 0.6.32) then time is computed as a sum of the file’s modification time and <value>time</value> specified in the directive. </para> <para> In addition, it is possible to specify a time of the day using the “<literal>@</literal>” prefix (0.7.9, 0.6.34): <example> expires @15h30m; </example> </para> <para> The <literal>epoch</literal> parameter corresponds to the absolute time “<literal>Thu, 01 Jan 1970 00:00:01 GMT</literal>”. The contents of the <header>Cache-Control</header> field depends on the sign of the specified time: <list type="bullet"> <listitem> time is negative — <header>Cache-Control: no-cache</header>. </listitem> <listitem> time is positive or zero — <header>Cache-Control: max-age=<value>t</value></header>, where <value>t</value> is a time specified in the directive, in seconds. </listitem> </list> </para> <para> The <literal>max</literal> parameter sets <header>Expires</header> to the value “<literal>Thu, 31 Dec 2037 23:55:55 GMT</literal>”, and <header>Cache-Control</header> to 10 years. </para> <para> The <literal>off</literal> parameter disables adding or modifying the <header>Expires</header> and <header>Cache-Control</header> response header fields. </para> </directive> </section> </module>