]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_session.html.en
update transformation
[apache] / docs / manual / mod / mod_session.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_session - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
12 <script src="../style/scripts/prettify.min.js" type="text/javascript">
13 </script>
14
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
16 <body>
17 <div id="page-header">
18 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
22 <div id="path">
23 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Module mod_session</h1>
26 <div class="toplang">
27 <p><span>Available Languages: </span><a href="../en/mod/mod_session.html" title="English">&nbsp;en&nbsp;</a></p>
28 </div>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Session support</td></tr>
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
31 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>session_module</td></tr>
32 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_session.c</td></tr>
33 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3 and later</td></tr></table>
34 <h3>Summary</h3>
35
36     <div class="warning"><h3>Warning</h3>
37       <p>The session modules make use of HTTP cookies, and as such can fall
38       victim to Cross Site Scripting attacks, or expose potentially private
39       information to clients. Please ensure that the relevant risks have
40       been taken into account before enabling the session functionality on
41       your server.</p>
42     </div>
43
44     <p>This module provides support for a server wide per user session
45     interface. Sessions can be used for keeping track of whether a user
46     has been logged in, or for other per user information that should
47     be kept available across requests.</p>
48
49     <p>Sessions may be stored on the server, or may be stored on the
50     browser. Sessions may also be optionally encrypted for added security.
51     These features are divided into several modules in addition to
52     <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>; <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code>,
53     <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code> and <code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code>.
54     Depending on the server requirements, load the appropriate modules
55     into the server (either statically at compile time or dynamically
56     via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> directive).</p>
57
58     <p>Sessions may be manipulated from other modules that depend on the
59     session, or the session may be read from and written to using
60     environment variables and HTTP headers, as appropriate.</p>
61
62 </div>
63 <div id="quickview"><h3 class="directives">Directives</h3>
64 <ul id="toc">
65 <li><img alt="" src="../images/down.gif" /> <a href="#session">Session</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#sessionenv">SessionEnv</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#sessionexclude">SessionExclude</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#sessionheader">SessionHeader</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#sessioninclude">SessionInclude</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#sessionmaxage">SessionMaxAge</a></li>
71 </ul>
72 <h3>Topics</h3>
73 <ul id="topics">
74 <li><img alt="" src="../images/down.gif" /> <a href="#whatisasession">What is a session?</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#whocanuseasession">Who can use a session?</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#serversession">Keeping sessions on the server</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#browsersession">Keeping sessions on the browser</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#basicexamples">Basic Examples</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#sessionprivacy">Session Privacy</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#cookieprivacy">Cookie Privacy</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#authentication">Session Support for Authentication</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#integration">Integrating Sessions with External Applications</a></li>
83 </ul><h3>See also</h3>
84 <ul class="seealso">
85 <li><code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code></li>
86 <li><code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code></li>
87 <li><code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code></li>
88 </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
89 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
90 <div class="section">
91 <h2><a name="whatisasession" id="whatisasession">What is a session?</a></h2>
92       <p>At the core of the session interface is a table of key and value pairs
93       that are made accessible across browser requests. These pairs can be set
94       to any valid string, as needed by the application making use of the
95       session.</p>
96
97       <p>The "session" is a <strong>application/x-www-form-urlencoded</strong>
98       string containing these key value pairs, as defined by the
99       <a href="http://www.w3.org/TR/html4/">HTML specification</a>.</p>
100
101       <p>The session can optionally be encrypted and base64 encoded before
102       being written to the storage mechanism, as defined by the
103       administrator.</p>
104
105     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
106 <div class="section">
107 <h2><a name="whocanuseasession" id="whocanuseasession">Who can use a session?</a></h2>
108       <p>The session interface is primarily developed for the use by other
109       server modules, such as <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code>, however CGI
110       based applications can optionally be granted access to the contents
111       of the session via the HTTP_SESSION environment variable. Sessions
112       have the option to be modified and/or updated by inserting an HTTP
113       response header containing the new session parameters.</p>
114
115     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
116 <div class="section">
117 <h2><a name="serversession" id="serversession">Keeping sessions on the server</a></h2>
118       <p>Apache can be configured to keep track of per user sessions stored
119       on a particular server or group of servers. This functionality is
120       similar to the sessions available in typical application servers.</p>
121
122       <p>If configured, sessions are tracked through the use of a session ID that
123       is stored inside a cookie, or extracted from the parameters embedded
124       within the URL query string, as found in a typical GET request.</p>
125
126       <p>As the contents of the session are stored exclusively on the server,
127       there is an expectation of privacy of the contents of the session. This
128       does have performance and resource implications should a large number
129       of sessions be present, or where a large number of webservers have to
130       share sessions with one another.</p>
131
132       <p>The <code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code> module allows the storage of user
133       sessions within a SQL database via <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code>.</p>
134
135     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
136 <div class="section">
137 <h2><a name="browsersession" id="browsersession">Keeping sessions on the browser</a></h2>
138       <p>In high traffic environments where keeping track of a session on a
139       server is too resource intensive or inconvenient, the option exists to store
140       the contents of the session within a cookie on the client browser instead.</p>
141
142       <p>This has the advantage that minimal resources are required on the
143       server to keep track of sessions, and multiple servers within a server
144       farm have no need to share session information.</p>
145
146       <p>The contents of the session however are exposed to the client, with a
147       corresponding risk of a loss of privacy. The
148       <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code> module can be configured to encrypt the
149       contents of the session before writing the session to the client.</p>
150
151       <p>The <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code> allows the storage of user
152       sessions on the browser within an HTTP cookie.</p>
153
154     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
155 <div class="section">
156 <h2><a name="basicexamples" id="basicexamples">Basic Examples</a></h2>
157
158       <p>Creating a session is as simple as turning the session on, and deciding
159       where the session will be stored. In this example, the session will be
160       stored on the browser, in a cookie called <code>session</code>.</p>
161
162       <div class="example"><h3>Browser based session</h3><pre class="prettyprint lang-config">Session On
163 SessionCookieName session path=/</pre>
164 </div>
165
166       <p>The session is not useful unless it can be written to or read from. The
167       following example shows how values can be injected into the session through
168       the use of a predetermined HTTP response header called
169       <code>X-Replace-Session</code>.</p>
170
171       <div class="example"><h3>Writing to a session</h3><pre class="prettyprint lang-config">Session On
172 SessionCookieName session path=/
173 SessionHeader X-Replace-Session</pre>
174 </div>
175
176       <p>The header should contain name value pairs expressed in the same format
177       as a query string in a URL, as in the example below. Setting a key to the
178       empty string has the effect of removing that key from the session.</p>
179
180       <div class="example"><h3>CGI to write to a session</h3><pre class="prettyprint lang-sh">#!/bin/bash
181 echo "Content-Type: text/plain"
182 echo "X-Replace-Session: key1=foo&amp;key2=&amp;key3=bar"
183 echo
184 env</pre>
185 </div>
186
187       <p>If configured, the session can be read back from the HTTP_SESSION
188       environment variable. By default, the session is kept private, so this
189       has to be explicitly turned on with the
190       <code class="directive"><a href="#sessionenv">SessionEnv</a></code> directive.</p>
191
192       <div class="example"><h3>Read from a session</h3><pre class="prettyprint lang-config">Session On
193 SessionEnv On
194 SessionCookieName session path=/
195 SessionHeader X-Replace-Session</pre>
196 </div>
197
198       <p>Once read, the CGI variable <code>HTTP_SESSION</code> should contain
199       the value <code>key1=foo&amp;key3=bar</code>.</p>
200
201     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
202 <div class="section">
203 <h2><a name="sessionprivacy" id="sessionprivacy">Session Privacy</a></h2>
204
205       <p>Using the "show cookies" feature of your browser, you would have seen
206       a clear text representation of the session. This could potentially be a
207       problem should the end user need to be kept unaware of the contents of
208       the session, or where a third party could gain unauthorised access to the
209       data within the session.</p>
210
211       <p>The contents of the session can be optionally encrypted before being
212       placed on the browser using the <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code>
213       module.</p>
214
215       <div class="example"><h3>Browser based encrypted session</h3><pre class="prettyprint lang-config">Session On
216 SessionCryptoPassphrase secret
217 SessionCookieName session path=/</pre>
218 </div>
219
220       <p>The session will be automatically decrypted on load, and encrypted on
221       save by Apache, the underlying application using the session need have
222       no knowledge that encryption is taking place.</p>
223
224       <p>Sessions stored on the server rather than on the browser can also be
225       encrypted as needed, offering privacy where potentially sensitive
226       information is being shared between webservers in a server farm using
227       the <code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code> module.</p>
228
229     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
230 <div class="section">
231 <h2><a name="cookieprivacy" id="cookieprivacy">Cookie Privacy</a></h2>
232
233       <p>The HTTP cookie mechanism also offers privacy features, such as the
234       ability to restrict cookie transport to SSL protected pages only, or
235       to prevent browser based javascript from gaining access to the contents
236       of the cookie.</p>
237
238       <div class="warning"><h3>Warning</h3>
239       <p>Some of the HTTP cookie privacy features are either non-standard, or
240       are not implemented consistently across browsers. The session modules
241       allow you to set cookie parameters, but it makes no guarantee that privacy
242       will be respected by the browser. If security is a concern, use the
243       <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code> to encrypt the contents of the session,
244       or store the session on the server using the <code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code>
245       module.</p>
246       </div>
247
248       <p>Standard cookie parameters can be specified after the name of the cookie,
249       as in the example below.</p>
250
251       <div class="example"><h3>Setting cookie parameters</h3><pre class="prettyprint lang-config">Session On
252 SessionCryptoPassphrase secret
253 SessionCookieName session path=/private;domain=example.com;httponly;secure;</pre>
254 </div>
255
256       <p>In cases where the Apache server forms the frontend for backend origin servers,
257       it is possible to have the session cookies removed from the incoming HTTP headers using
258       the <code class="directive"><a href="../mod/mod_session_cookie.html#sessioncookieremove">SessionCookieRemove</a></code> directive.
259       This keeps the contents of the session cookies from becoming accessible from the
260       backend server.
261       </p>
262
263     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
264 <div class="section">
265 <h2><a name="authentication" id="authentication">Session Support for Authentication</a></h2>
266
267       <p>As is possible within many application servers, authentication modules can use
268       a session for storing the username and password after login. The
269       <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> saves the user's login name and password within
270       the session.</p>
271
272       <div class="example"><h3>Form based authentication</h3><pre class="prettyprint lang-config">Session On
273 SessionCryptoPassphrase secret
274 SessionCookieName session path=/
275 AuthFormProvider file
276 AuthUserFile conf/passwd
277 AuthType form
278 AuthName realm
279 #...</pre>
280 </div>
281
282       <p>See the <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> module for documentation and complete
283       examples.</p>
284
285     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
286 <div class="section">
287 <h2><a name="integration" id="integration">Integrating Sessions with External Applications</a></h2>
288
289       <p>In order for sessions to be useful, it must be possible to share the contents
290       of a session with external applications, and it must be possible for an
291       external application to write a session of its own.</p>
292
293       <p> A typical example might be an application that changes a user's password set by
294       <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code>. This application would need to read the current
295       username and password from the session, make the required changes to the user's
296       password, and then write the new password to the session in order to provide a
297       seamless transition to the new password.</p>
298
299       <p>A second example might involve an application that registers a new user for
300       the first time. When registration is complete, the username and password is
301       written to the session, providing a seamless transition to being logged in.</p>
302
303       <dl>
304       <dt>Apache modules</dt>
305       <dd>Modules within the server that need access to the session can use the
306       <strong>mod_session.h</strong> API in order to read from and write to the
307       session. This mechanism is used by modules like <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code>.
308       </dd>
309
310       <dt>CGI programs and scripting languages</dt>
311       <dd>Applications that run within the webserver can optionally retrieve the
312       value of the session from the <strong>HTTP_SESSION</strong> environment
313       variable. The session should be encoded as a
314       <strong>application/x-www-form-urlencoded</strong> string as described by the
315       <a href="http://www.w3.org/TR/html4/">HTML specification</a>. The environment
316       variable is controlled by the setting of the
317       <code class="directive"><a href="#sessionenv">SessionEnv</a></code> directive. The session
318       can be written to by the script by returning a
319       <strong>application/x-www-form-urlencoded</strong> response header with a name
320       set by the <code class="directive"><a href="#sessionheader">SessionHeader</a></code>
321       directive. In both cases, any encryption or decryption, and the reading the
322       session from or writing the session to the chosen storage mechanism is handled
323       by the <code class="module"><a href="../mod/mod_session.html">mod_session</a></code> modules and corresponding configuration.
324       </dd>
325       
326       <dt>Applications behind <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></dt>
327       <dd>If the <code class="directive"><a href="#sessionheader">SessionHeader</a></code>
328       directive is used to define an HTTP request header, the session, encoded as
329       a <strong>application/x-www-form-urlencoded</strong> string, will be made
330       available to the application. If the same header is provided in the response,
331       the value of this response header will be used to replace the session. As
332       above, any encryption or decryption, and the reading the session from or
333       writing the session to the chosen storage mechanism is handled by the
334       <code class="module"><a href="../mod/mod_session.html">mod_session</a></code> modules and corresponding configuration.</dd>
335       
336       <dt>Standalone applications</dt>
337       <dd>Applications might choose to manipulate the session outside the control
338       of the Apache HTTP server. In this case, it is the responsibility of the
339       application to read the session from the chosen storage mechanism,
340       decrypt the session, update the session, encrypt the session and write
341       the session to the chosen storage mechanism, as appropriate.</dd>
342       </dl>
343
344     </div>
345 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
346 <div class="directive-section"><h2><a name="Session" id="Session">Session</a> <a name="session" id="session">Directive</a></h2>
347 <table class="directive">
348 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a session for the current directory or location</td></tr>
349 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Session On|Off</code></td></tr>
350 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Session Off</code></td></tr>
351 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
352 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
353 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
354 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
355 </table>
356     <p>The <code class="directive">Session</code> directive enables a session for the
357     directory or location container. Further directives control where the
358     session will be stored and how privacy is maintained.</p>
359
360 </div>
361 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
362 <div class="directive-section"><h2><a name="SessionEnv" id="SessionEnv">SessionEnv</a> <a name="sessionenv" id="sessionenv">Directive</a></h2>
363 <table class="directive">
364 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control whether the contents of the session are written to the
365 <var>HTTP_SESSION</var> environment variable</td></tr>
366 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionEnv On|Off</code></td></tr>
367 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SessionEnv Off</code></td></tr>
368 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
369 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
370 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
371 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
372 </table>
373     <p>If set to <var>On</var>, the <code class="directive">SessionEnv</code> directive
374     causes the contents of the session to be written to a CGI environment
375     variable called <var>HTTP_SESSION</var>.</p>
376
377     <p>The string is written in the URL query format, for example:</p>
378
379     <div class="example"><p><code>
380       <code>key1=foo&amp;key3=bar</code>
381     </code></p></div>
382
383
384 </div>
385 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
386 <div class="directive-section"><h2><a name="SessionExclude" id="SessionExclude">SessionExclude</a> <a name="sessionexclude" id="sessionexclude">Directive</a></h2>
387 <table class="directive">
388 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define URL prefixes for which a session is ignored</td></tr>
389 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionExclude <var>path</var></code></td></tr>
390 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
391 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
392 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
393 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
394 </table>
395     <p>The <code class="directive">SessionExclude</code> directive allows sessions to
396     be disabled relative to URL prefixes only. This can be used to make a
397     website more efficient, by targeting a more precise URL space for which
398     a session should be maintained. By default, all URLs within the directory
399     or location are included in the session. The
400     <code class="directive"><a href="#sessionexclude">SessionExclude</a></code> directive takes
401     precedence over the
402     <code class="directive"><a href="#sessioninclude">SessionInclude</a></code> directive.</p>
403
404     <div class="warning"><h3>Warning</h3>
405     <p>This directive has a similar purpose to the <var>path</var> attribute
406     in HTTP cookies, but should not be confused with this attribute. This
407     directive does not set the <var>path</var> attribute, which must be
408     configured separately.</p></div>
409
410 </div>
411 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
412 <div class="directive-section"><h2><a name="SessionHeader" id="SessionHeader">SessionHeader</a> <a name="sessionheader" id="sessionheader">Directive</a></h2>
413 <table class="directive">
414 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Import session updates from a given HTTP response header</td></tr>
415 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionHeader <var>header</var></code></td></tr>
416 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
417 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
418 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
419 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
420 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
421 </table>
422     <p>The <code class="directive">SessionHeader</code> directive defines the name of an
423     HTTP response header which, if present, will be parsed and written to the
424     current session.</p>
425
426     <p>The header value is expected to be in the URL query format, for example:</p>
427
428     <div class="example"><p><code>
429       <code>key1=foo&amp;key2=&amp;key3=bar</code>
430     </code></p></div>
431
432     <p>Where a key is set to the empty string, that key will be removed from the
433     session.</p>
434
435
436 </div>
437 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
438 <div class="directive-section"><h2><a name="SessionInclude" id="SessionInclude">SessionInclude</a> <a name="sessioninclude" id="sessioninclude">Directive</a></h2>
439 <table class="directive">
440 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define URL prefixes for which a session is valid</td></tr>
441 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionInclude <var>path</var></code></td></tr>
442 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>all URLs</code></td></tr>
443 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
444 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
445 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
446 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
447 </table>
448     <p>The <code class="directive">SessionInclude</code> directive allows sessions to
449     be made valid for specific URL prefixes only. This can be used to make a
450     website more efficient, by targeting a more precise URL space for which
451     a session should be maintained. By default, all URLs within the directory
452     or location are included in the session.</p>
453
454     <div class="warning"><h3>Warning</h3>
455     <p>This directive has a similar purpose to the <var>path</var> attribute
456     in HTTP cookies, but should not be confused with this attribute. This
457     directive does not set the <var>path</var> attribute, which must be
458     configured separately.</p></div>
459
460 </div>
461 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
462 <div class="directive-section"><h2><a name="SessionMaxAge" id="SessionMaxAge">SessionMaxAge</a> <a name="sessionmaxage" id="sessionmaxage">Directive</a></h2>
463 <table class="directive">
464 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a maximum age in seconds for a session</td></tr>
465 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionMaxAge <var>maxage</var></code></td></tr>
466 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SessionMaxAge 0</code></td></tr>
467 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
468 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
469 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
470 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session</td></tr>
471 </table>
472     <p>The <code class="directive">SessionMaxAge</code> directive defines a time limit
473     for which a session will remain valid. When a session is saved, this time
474     limit is reset and an existing session can be continued. If a session
475     becomes older than this limit without a request to the server to refresh
476     the session, the session will time out and be removed. Where a session is
477     used to stored user login details, this has the effect of logging the user
478     out automatically after the given time.</p>
479
480     <p>Setting the maxage to zero disables session expiry.</p>
481
482 </div>
483 </div>
484 <div class="bottomlang">
485 <p><span>Available Languages: </span><a href="../en/mod/mod_session.html" title="English">&nbsp;en&nbsp;</a></p>
486 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
487 <script type="text/javascript"><!--//--><![CDATA[//><!--
488 var comments_shortname = 'httpd';
489 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_session.html';
490 (function(w, d) {
491     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
492         d.write('<div id="comments_thread"><\/div>');
493         var s = d.createElement('script');
494         s.type = 'text/javascript';
495         s.async = true;
496         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
497         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
498     }
499     else {
500         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
501     }
502 })(window, document);
503 //--><!]]></script></div><div id="footer">
504 <p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
505 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
506 if (typeof(prettyPrint) !== 'undefined') {
507     prettyPrint();
508 }
509 //--><!]]></script>
510 </body></html>