]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_session_cookie.xml
mod_session_cookie: Add a session implementation capable of storing
[apache] / docs / manual / mod / mod_session_cookie.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision: 634760 $ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_session_cookie.xml.meta">
24
25 <name>mod_session_cookie</name>
26 <description>Cookie based session support</description>
27 <status>Extension</status>
28 <sourcefile>mod_session_cookie.c</sourcefile>
29 <identifier>session_cookie_module</identifier>
30
31 <summary>
32     <note type="warning"><title>Warning</title>
33       <p>The session modules make use of HTTP cookies, and as such can fall
34       victim to Cross Site Scripting attacks, or expose potentially private
35       information to clients. Please ensure that the relevant risks have
36       been taken into account before enabling the session functionality on
37       your server.</p>
38     </note>
39
40     <p>This submodule of <module>mod_session</module> provides support for the
41     storage of user sessions on the remote browser within HTTP cookies.</p>
42     
43     <p>Using cookies to store a session removes the need for the server or
44     a group of servers to store the session locally, or collaborate to share
45     a session, and can be useful for high traffic environments where a
46     server based session might be too resource intensive.</p>
47     
48     <p>If session privacy is required, the <module>mod_session_crypto</module>
49     module can be used to encrypt the contents of the session before writing
50     the session to the client.</p>
51     
52     <p>For more details on the session interface, see the documentation for
53     the <module>mod_session</module> module.</p>
54     
55 </summary>
56 <seealso><module>mod_session</module></seealso>
57 <seealso><module>mod_session_crypto</module></seealso>
58 <seealso><module>mod_session_dbd</module></seealso>
59
60     <section id="basicexamples"><title>Basic Examples</title>
61     
62       <p>To create a simple session and store it in a cookie called
63       <var>session</var>, configure the session as follows:</p>
64       
65       <example><title>Browser based session</title>
66         Session On<br />
67         SessionCookieName session path=/<br />
68       </example>
69       
70       <p>For more examples on how the session can be configured to be read
71       from and written to by a CGI application, see the
72       <module>mod_session</module> examples section.</p>
73       
74       <p>For documentation on how the session can be used to store username
75       and password details, see the <module>mod_auth_form</module> module.</p>
76
77     </section>
78
79 <directivesynopsis>
80 <name>SessionCookieName</name>
81 <description>Name and attributes for the RFC2109 cookie storing the session</description>
82 <syntax>SessionCookieName <var>name</var> <var>attributes</var></syntax>
83 <default>none</default>
84 <contextlist><context>directory</context>
85 </contextlist>
86 <compatibility>Available in Apache 2.3.0 and later</compatibility>
87
88 <usage>
89     <p>The <directive>SessionCookieName</directive> directive specifies the name and
90     optional attributes of an RFC2109 compliant cookie inside which the session will
91     be stored. RFC2109 cookies are set using the <code>Set-Cookie</code> HTTP header.
92     </p>
93     
94     <p>An optional list of cookie attributes can be specified, as per the example below.
95     These attributes are inserted into the cookie as is, and are not interpreted by
96     Apache. Ensure that your attributes are defined correctly as per the cookie specification.
97     </p>
98     
99     <example><title>Cookie with attributes</title>
100       Session On<br />
101       SessionCookieName session path=/private;domain=example.com;httponly;secure;version=1;<br />
102     </example>
103
104 </usage>
105 </directivesynopsis>
106
107 <directivesynopsis>
108 <name>SessionCookieName2</name>
109 <description>Name and attributes for the RFC2965 cookie storing the session</description>
110 <syntax>SessionCookieName2 <var>name</var> <var>attributes</var></syntax>
111 <default>none</default>
112 <contextlist><context>directory</context>
113 </contextlist>
114 <compatibility>Available in Apache 2.3.0 and later</compatibility>
115
116 <usage>
117     <p>The <directive>SessionCookieName2</directive> directive specifies the name and
118     optional attributes of an RFC2965 compliant cookie inside which the session will
119     be stored. RFC2965 cookies are set using the <code>Set-Cookie2</code> HTTP header.
120     </p>
121     
122     <p>An optional list of cookie attributes can be specified, as per the example below.
123     These attributes are inserted into the cookie as is, and are not interpreted by
124     Apache. Ensure that your attributes are defined correctly as per the cookie specification.
125     </p>
126     
127     <example><title>Cookie2 with attributes</title>
128       Session On<br />
129       SessionCookieName2 session path=/private;domain=example.com;httponly;secure;version=1;<br />
130     </example>
131
132 </usage>
133 </directivesynopsis>
134
135 <directivesynopsis>
136 <name>SessionCookieRemove</name>
137 <description>Control for whether session cookies should be removed from incoming HTTP headers</description>
138 <syntax>SessionCookieRemove On|Off</syntax>
139 <default>SessionCookieRemove Off</default>
140 <contextlist><context>directory</context>
141 </contextlist>
142 <compatibility>Available in Apache 2.3.0 and later</compatibility>
143
144 <usage>
145     <p>The <directive>SessionCookieRemove</directive> flag controls whether the cookies
146     containing the session will be removed from the headers during request processing.</p>
147     
148     <p>In a reverse proxy situation where the Apache server acts as a server frontend for
149     a backend origin server, revealing the contents of the session cookie to the backend
150     could be a potential privacy violation. When set to on, the session cookie will be
151     removed from the incoming HTTP headers.</p>
152
153 </usage>
154 </directivesynopsis>
155
156 </modulesynopsis>