summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_session_cookie.xml
blob: 5eadd4ffdb276d1b4292acca0eaefdd2d9c4b562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_session_cookie.xml.meta">

<name>mod_session_cookie</name>
<description>Cookie based session support</description>
<status>Extension</status>
<sourcefile>mod_session_cookie.c</sourcefile>
<identifier>session_cookie_module</identifier>
<compatibility>Available in Apache 2.3 and later</compatibility>

<summary>
    <note type="warning"><title>Warning</title>
      <p>The session modules make use of HTTP cookies, and as such can fall
      victim to Cross Site Scripting attacks, or expose potentially private
      information to clients. Please ensure that the relevant risks have
      been taken into account before enabling the session functionality on
      your server.</p>
    </note>

    <p>This submodule of <module>mod_session</module> provides support for the
    storage of user sessions on the remote browser within HTTP cookies.</p>

    <p>Using cookies to store a session removes the need for the server or
    a group of servers to store the session locally, or collaborate to share
    a session, and can be useful for high traffic environments where a
    server based session might be too resource intensive.</p>

    <p>If session privacy is required, the <module>mod_session_crypto</module>
    module can be used to encrypt the contents of the session before writing
    the session to the client.</p>

    <p>For more details on the session interface, see the documentation for
    the <module>mod_session</module> module.</p>

</summary>
<seealso><module>mod_session</module></seealso>
<seealso><module>mod_session_crypto</module></seealso>
<seealso><module>mod_session_dbd</module></seealso>

    <section id="basicexamples"><title>Basic Examples</title>

      <p>To create a simple session and store it in a cookie called
      <var>session</var>, configure the session as follows:</p>

      <example><title>Browser based session</title>
        Session On<br />
        SessionCookieName session path=/<br />
      </example>

      <p>For more examples on how the session can be configured to be read
      from and written to by a CGI application, see the
      <module>mod_session</module> examples section.</p>

      <p>For documentation on how the session can be used to store username
      and password details, see the <module>mod_auth_form</module> module.</p>

    </section>

<directivesynopsis>
<name>SessionCookieName</name>
<description>Name and attributes for the RFC2109 cookie storing the session</description>
<syntax>SessionCookieName <var>name</var> <var>attributes</var></syntax>
<default>none</default>
<contextlist><context>server config</context>
<context>virtual host</context>
<context>directory</context>
<context>.htaccess</context>
</contextlist>

<usage>
    <p>The <directive>SessionCookieName</directive> directive specifies the name and
    optional attributes of an RFC2109 compliant cookie inside which the session will
    be stored. RFC2109 cookies are set using the <code>Set-Cookie</code> HTTP header.
    </p>

    <p>An optional list of cookie attributes can be specified, as per the example below.
    These attributes are inserted into the cookie as is, and are not interpreted by
    Apache. Ensure that your attributes are defined correctly as per the cookie specification.
    </p>

    <example><title>Cookie with attributes</title>
      Session On<br />
      SessionCookieName session path=/private;domain=example.com;httponly;secure;version=1;<br />
    </example>

</usage>
</directivesynopsis>

<directivesynopsis>
<name>SessionCookieName2</name>
<description>Name and attributes for the RFC2965 cookie storing the session</description>
<syntax>SessionCookieName2 <var>name</var> <var>attributes</var></syntax>
<default>none</default>
<contextlist><context>server config</context>
<context>virtual host</context>
<context>directory</context>
<context>.htaccess</context>
</contextlist>

<usage>
    <p>The <directive>SessionCookieName2</directive> directive specifies the name and
    optional attributes of an RFC2965 compliant cookie inside which the session will
    be stored. RFC2965 cookies are set using the <code>Set-Cookie2</code> HTTP header.
    </p>

    <p>An optional list of cookie attributes can be specified, as per the example below.
    These attributes are inserted into the cookie as is, and are not interpreted by
    Apache. Ensure that your attributes are defined correctly as per the cookie specification.
    </p>

    <example><title>Cookie2 with attributes</title>
      Session On<br />
      SessionCookieName2 session path=/private;domain=example.com;httponly;secure;version=1;<br />
    </example>

</usage>
</directivesynopsis>

<directivesynopsis>
<name>SessionCookieRemove</name>
<description>Control for whether session cookies should be removed from incoming HTTP headers</description>
<syntax>SessionCookieRemove On|Off</syntax>
<default>SessionCookieRemove Off</default>
<contextlist><context>server config</context>
<context>virtual host</context>
<context>directory</context>
<context>.htaccess</context>
</contextlist>

<usage>
    <p>The <directive>SessionCookieRemove</directive> flag controls whether the cookies
    containing the session will be removed from the headers during request processing.</p>

    <p>In a reverse proxy situation where the Apache server acts as a server frontend for
    a backend origin server, revealing the contents of the session cookie to the backend
    could be a potential privacy violation. When set to on, the session cookie will be
    removed from the incoming HTTP headers.</p>

</usage>
</directivesynopsis>

</modulesynopsis>