253 lines
15 KiB
HTML
253 lines
15 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="topic" />
|
|
<meta name="DC.Title" content="Module mod_expires" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzaiemod_expires" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Module mod_expires</title>
|
|
</head>
|
|
<body id="rzaiemod_expires"><a name="rzaiemod_expires"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<!--Java sync-link--><h1 class="topictitle1">Module mod_expires</h1>
|
|
<div><div class="important"><span class="importanttitle">Important:</span> Information
|
|
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
|
|
It is recommended that you install the latest PTFs to upgrade to the latest
|
|
level of the HTTP Server for i5/OS. Some of the topics documented here are
|
|
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
|
|
<p><strong>Summary</strong></p>
|
|
<p>This module controls the setting of the Expires HTTP header in server responses.
|
|
The expiration date can be set relative to either the time that the source
|
|
file was last modified, or relative to the time that the client accessed the
|
|
server.</p>
|
|
<p>The Expires HTTP header is an instruction to the client regarding the document's
|
|
validity and persistence. If cached, the document may be retrieved from the
|
|
cache rather than from the source until the allocated time has passed. After
|
|
this occurs, the cache copy is considered "expired" and a new copy must be
|
|
obtained from the source.</p>
|
|
<p><strong>Alternate Interval Syntax</strong></p>
|
|
<p>The ExpiresDefault and ExpiresByType directives can also be defined in
|
|
a more readable syntax of the form: </p>
|
|
<pre class="block">ExpiresDefault <em>"<base> [plus] {<num> <type>}*"</em>
|
|
ExpiresByType <em>type|encoding "<base> [plus] {<num> <type>}*"</em></pre>
|
|
<p>The <em><base></em> argument is one of the following:</p>
|
|
<ul><li>access</li>
|
|
<li>now (equivalent to 'access')</li>
|
|
<li>modification </li>
|
|
</ul>
|
|
<p>The <em>[plus]</em> keyword is optional. The <em><num></em> argument should
|
|
be an integer value [acceptable to atoi()], and <em><type></em> is one of
|
|
the following: </p>
|
|
<ul><li>years</li>
|
|
<li>months</li>
|
|
<li>weeks</li>
|
|
<li>days</li>
|
|
<li>hours</li>
|
|
<li>minutes</li>
|
|
<li>seconds</li>
|
|
</ul>
|
|
<p>For example, any of the following directives can be used to make documents
|
|
expire 1 month after being accessed, by default: </p>
|
|
<pre class="block">ExpiresDefault "access plus 1 month"
|
|
ExpiresDefault "access plus 4 weeks"
|
|
ExpiresDefault "access plus 30 days"</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> Time is stored in seconds. The value month is actually calculated as
|
|
60*60*24*30 seconds. Keep in mind that one month is equal 30 days, and 4 weeks
|
|
is only equal to 28 days. If you specify 52 weeks, it is calculated as 362
|
|
days instead of 365 days. </div>
|
|
<p>The expiry time can be fine-tuned by adding several <num> and <type>
|
|
arguments. For example:</p>
|
|
<pre class="block">ExpiresByType text/html"access plus 1 month 15 days 2 hours"
|
|
ExpiresByType image/gif "modification plus 5 hours 3 minutes"</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> If you use a modification date based setting, the Expires header is
|
|
added only to content that comes from a file on a disk, because there is no
|
|
modification time for content that does not come from a file on a disk. </div>
|
|
<p><strong>Directives</strong></p>
|
|
<ul><li><a href="#expiresactive">ExpiresActive</a></li>
|
|
<li><a href="#expiresbytype">ExpiresByType</a></li>
|
|
<li><a href="#expiresdefault">ExpiresDefault</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="hr" id="expiresactive"><a name="expiresactive"><!-- --></a><h2 class="topictitle2">ExpiresActive</h2>
|
|
<div>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><tbody><tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Module">Module</a></strong>: mod_expires </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Syntax">Syntax</a></strong>: ExpiresActive <em>on | off</em> </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Default">Default</a></strong>: ExpiresActive off </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Context">Context</a></strong>: <span id="expiresactive__expiresactive_context"><a name="expiresactive__expiresactive_context"><!-- --></a>server config,
|
|
virtual host, directory, .htaccess </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Override">Override</a></strong>: Indexes </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Origin">Origin</a></strong>: <span id="expiresactive__expiresactive_origin"><a name="expiresactive__expiresactive_origin"><!-- --></a>Apache </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: ExpiresActive on </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p>The ExpiresActive directive enables or disables the generation of the Expires
|
|
header for the document realm in question. If this directive is found in an
|
|
.htaccess file it only applies to documents generated from that directory.</p>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter</strong>: <em>on | off </em></dt>
|
|
<dd><ul><li>If set to <em>on</em>, an Expires header will be added to served documents
|
|
according to criteria set by the ExpiresByType and ExpiresDefault directives. </li>
|
|
<li>If set to <em>off</em>, an Expires header will not be generated for any
|
|
document in the realm (unless overridden at a lower level, such as an .htaccess
|
|
file overriding a server config file).</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<div class="note"><span class="notetitle">Note:</span> This directive does not guarantee that an Expires header will be generated.
|
|
If the criteria is not met, no header will be sent, and the effect will be
|
|
as though this directive was never specified.</div>
|
|
</div>
|
|
</div>
|
|
<div class="hr" id="expiresbytype"><a name="expiresbytype"><!-- --></a><h2 class="topictitle2">ExpiresByType</h2>
|
|
<div>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><tbody><tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Module">Module</a></strong>: mod_expires </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Syntax">Syntax</a></strong>: ExpiresByType <em>MIME-type code seconds
|
|
| "<base> [plus] <num> <type>"</em></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Default">Default</a></strong>: none </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Context">Context</a></strong>: <span id="expiresbytype__expiresbytype_context"><a name="expiresbytype__expiresbytype_context"><!-- --></a>server config,
|
|
virtual host, directory, .htaccess </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Override">Override</a></strong>: Indexes </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Origin">Origin</a></strong>: <span id="expiresbytype__expiresbytype_origin"><a name="expiresbytype__expiresbytype_origin"><!-- --></a>Apache </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: ExpiresByType image/gif A2592000 </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: ExpiresByType text/html "access plus 30
|
|
days" </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p>The ExpiresByType directive defines the value of the Expires header generated
|
|
for documents of the specified type ( for example, text/html). The second
|
|
argument sets the number of seconds that will be added to a base time to construct
|
|
the expiration date.</p>
|
|
<p>The base time is either the last modification time of the file, or the
|
|
time of the client's access to the document. Whether access time or modification
|
|
time should be used is specified by the code field. <em>M</em> means that the
|
|
file's last modification time should be used as the base time, and <em>A</em> means
|
|
the client's access time should be used.</p>
|
|
<p>The difference in effect between the <em>A</em> and the <em>M</em> is minimal.
|
|
If <em>M</em> is used, all current copies of the document in all caches will
|
|
expire at the same time. This could be useful for something like a weekly
|
|
notice that is always found at the same URL. If <em>A</em> is used, the date
|
|
of expiration is different for each client. This could be useful for image
|
|
files that do not change very often, particularly for a set of related documents
|
|
that all refer to the same images ( for example, the images will be accessed
|
|
repeatedly within a relatively short time span). </p>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter One</strong>: <em>MIME-type </em></dt>
|
|
<dd><ul><li>The document type for which an Expires header should be generated.</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter Two</strong>: <em>code </em></dt>
|
|
<dd><ul><li>The <em>code</em> parameter specifies one of two possible choices. Specify <em>A</em> if
|
|
the expiration time should be calculated from the time the resource was accessed.
|
|
Specify <em>M</em> if the expiration time should be calculated from the last
|
|
modified date of the resource. </li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter Three</strong>: <em>seconds </em></dt>
|
|
<dd><ul><li>The <em>seconds</em> parameter is a number of seconds until the resource
|
|
expires.</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<p>Here is an example to specify the expiration time calculation. For examples
|
|
using alternate syntax, see the beginning of this article.</p>
|
|
<pre class="block">#enable expirations
|
|
ExpiresActive on
|
|
#expire GIF images after a month in the clients cache
|
|
ExpiresByType image/fig A2592000
|
|
#HTML documents are good for a week from the time they were changed
|
|
ExpiresByType text/html M604800</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This directive only has effect if ExpiresActive On has been specified.
|
|
It overrides, for the specified MIME type only, any expiration date set by
|
|
the ExpiresDefault directive. If you use a modification date based setting,
|
|
the Expires header will not be added to content that does not come from a
|
|
file on disk. This is due to the fact that there is no modification time for
|
|
such content. </div>
|
|
</div>
|
|
</div>
|
|
<div class="hr" id="expiresdefault"><a name="expiresdefault"><!-- --></a><h2 class="topictitle2">ExpiresDefault</h2>
|
|
<div>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><tbody><tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Module">Module</a></strong>: mod_expires </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Syntax">Syntax</a></strong>: ExpiresDefault <em>code seconds| "<base>
|
|
[plus] <num> <type>"</em></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Default">Default</a></strong>: none </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Context">Context</a></strong>: <span id="expiresdefault__expiresdefault_context"><a name="expiresdefault__expiresdefault_context"><!-- --></a>server
|
|
config, virtual host, directory, .htaccess </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Override">Override</a></strong>: Indexes </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Origin">Origin</a></strong>: <span id="expiresdefault__expiresdefault_origin"><a name="expiresdefault__expiresdefault_origin"><!-- --></a>Apache </span></td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: ExpiresDefault A2592000 </td>
|
|
</tr>
|
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: ExpiresDefault "access plus 1 month" </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p>The ExpiresDefault directive sets the default algorithm for calculating
|
|
the expiration time for all documents in the affected realm. It can be overridden
|
|
on a type-by-type basis by the ExpiresByType directive. See the description
|
|
of the ExpiresByType directive for details about the syntax of the argument,
|
|
and the alternate syntax description as well. </p>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter One</strong>: <em>code</em></dt>
|
|
<dd><ul><li>The code parameter specifies has two arguments. Specify <em>A</em> if the
|
|
expiration time should be calculated from the time the resource was accessed.
|
|
Specify <em>M</em> if the expiration time should be calculated from the last
|
|
modified date of the resource. </li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="block"><dt class="dlterm"><strong>Parameter Two</strong>: <em>seconds </em></dt>
|
|
<dd><ul><li>The <em>seconds</em> parameter is a number of seconds until the resource
|
|
expires.</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<div class="note"><span class="notetitle">Note:</span> <ul><li>If you use a modification date based setting, the Expires header will
|
|
not be added to content that does not come from a file on disk. This is due
|
|
to the fact that there is no modification time for such content. </li>
|
|
<li>You can also specify the expiration time calculation using the alternate
|
|
interval syntax. For examples using alternate syntax, see the
|
|
beginning of this article.</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |