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
8 <title>mod_session_cookie - 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" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.4</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_session_cookie</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_session_cookie.html" title="English"> en </a></p>
26 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Cookie based session support</td></tr>
27 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
28 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>session_cookie_module</td></tr>
29 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_session_cookie.c</td></tr>
30 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3 and later</td></tr></table>
33 <div class="warning"><h3>Warning</h3>
34 <p>The session modules make use of HTTP cookies, and as such can fall
35 victim to Cross Site Scripting attacks, or expose potentially private
36 information to clients. Please ensure that the relevant risks have
37 been taken into account before enabling the session functionality on
41 <p>This submodule of <code class="module"><a href="../mod/mod_session.html">mod_session</a></code> provides support for the
42 storage of user sessions on the remote browser within HTTP cookies.</p>
44 <p>Using cookies to store a session removes the need for the server or
45 a group of servers to store the session locally, or collaborate to share
46 a session, and can be useful for high traffic environments where a
47 server based session might be too resource intensive.</p>
49 <p>If session privacy is required, the <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code>
50 module can be used to encrypt the contents of the session before writing
51 the session to the client.</p>
53 <p>For more details on the session interface, see the documentation for
54 the <code class="module"><a href="../mod/mod_session.html">mod_session</a></code> module.</p>
57 <div id="quickview"><h3 class="directives">Directives</h3>
59 <li><img alt="" src="../images/down.gif" /> <a href="#sessioncookiename">SessionCookieName</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#sessioncookiename2">SessionCookieName2</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#sessioncookieremove">SessionCookieRemove</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#basicexamples">Basic Examples</a></li>
66 </ul><h3>See also</h3>
68 <li><code class="module"><a href="../mod/mod_session.html">mod_session</a></code></li>
69 <li><code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code></li>
70 <li><code class="module"><a href="../mod/mod_session_dbd.html">mod_session_dbd</a></code></li>
72 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
74 <h2><a name="basicexamples" id="basicexamples">Basic Examples</a></h2>
76 <p>To create a simple session and store it in a cookie called
77 <var>session</var>, configure the session as follows:</p>
79 <div class="example"><h3>Browser based session</h3><p><code>
81 SessionCookieName session path=/<br />
84 <p>For more examples on how the session can be configured to be read
85 from and written to by a CGI application, see the
86 <code class="module"><a href="../mod/mod_session.html">mod_session</a></code> examples section.</p>
88 <p>For documentation on how the session can be used to store username
89 and password details, see the <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> module.</p>
92 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
93 <div class="directive-section"><h2><a name="SessionCookieName" id="SessionCookieName">SessionCookieName</a> <a name="sessioncookiename" id="sessioncookiename">Directive</a></h2>
94 <table class="directive">
95 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name and attributes for the RFC2109 cookie storing the session</td></tr>
96 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionCookieName <var>name</var> <var>attributes</var></code></td></tr>
97 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
98 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
99 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
100 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session_cookie</td></tr>
102 <p>The <code class="directive">SessionCookieName</code> directive specifies the name and
103 optional attributes of an RFC2109 compliant cookie inside which the session will
104 be stored. RFC2109 cookies are set using the <code>Set-Cookie</code> HTTP header.
107 <p>An optional list of cookie attributes can be specified, as per the example below.
108 These attributes are inserted into the cookie as is, and are not interpreted by
109 Apache. Ensure that your attributes are defined correctly as per the cookie specification.
112 <div class="example"><h3>Cookie with attributes</h3><p><code>
114 SessionCookieName session path=/private;domain=example.com;httponly;secure;version=1;<br />
119 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
120 <div class="directive-section"><h2><a name="SessionCookieName2" id="SessionCookieName2">SessionCookieName2</a> <a name="sessioncookiename2" id="sessioncookiename2">Directive</a></h2>
121 <table class="directive">
122 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name and attributes for the RFC2965 cookie storing the session</td></tr>
123 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionCookieName2 <var>name</var> <var>attributes</var></code></td></tr>
124 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
125 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
126 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
127 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session_cookie</td></tr>
129 <p>The <code class="directive">SessionCookieName2</code> directive specifies the name and
130 optional attributes of an RFC2965 compliant cookie inside which the session will
131 be stored. RFC2965 cookies are set using the <code>Set-Cookie2</code> HTTP header.
134 <p>An optional list of cookie attributes can be specified, as per the example below.
135 These attributes are inserted into the cookie as is, and are not interpreted by
136 Apache. Ensure that your attributes are defined correctly as per the cookie specification.
139 <div class="example"><h3>Cookie2 with attributes</h3><p><code>
141 SessionCookieName2 session path=/private;domain=example.com;httponly;secure;version=1;<br />
146 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
147 <div class="directive-section"><h2><a name="SessionCookieRemove" id="SessionCookieRemove">SessionCookieRemove</a> <a name="sessioncookieremove" id="sessioncookieremove">Directive</a></h2>
148 <table class="directive">
149 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Control for whether session cookies should be removed from incoming HTTP headers</td></tr>
150 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SessionCookieRemove On|Off</code></td></tr>
151 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SessionCookieRemove Off</code></td></tr>
152 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
153 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
154 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_session_cookie</td></tr>
156 <p>The <code class="directive">SessionCookieRemove</code> flag controls whether the cookies
157 containing the session will be removed from the headers during request processing.</p>
159 <p>In a reverse proxy situation where the Apache server acts as a server frontend for
160 a backend origin server, revealing the contents of the session cookie to the backend
161 could be a potential privacy violation. When set to on, the session cookie will be
162 removed from the incoming HTTP headers.</p>
167 <div class="bottomlang">
168 <p><span>Available Languages: </span><a href="../en/mod/mod_session_cookie.html" title="English"> en </a></p>
169 </div><div id="footer">
170 <p class="apache">Copyright 2012 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>
171 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>