|
The ngx_http_userid_module module sets cookies
suitable for client identification.
Received and set cookies can be logged using the embedded variables
$uid_got and
$uid_set.
This module is compatible with the
mod_uid
module for Apache.
Example Configuration
userid on;
userid_name uid;
userid_domain example.com;
userid_path /;
userid_expires 365d;
userid_p3p 'policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR STA NID"';
Directives
|
syntax:
|
userid
on |
v1 |
log |
off;
|
|
default:
|
userid off;
|
|
context:
|
http, server, location
|
Allows or prohibits to set cookies and log the received cookies:
on
-
allows to set version 2 cookies
and log the received cookies;
v1
-
allows to set version 1 cookies
and log the received cookies;
log
-
prohibits to set cookies
but allows to log the received cookies;
off
-
prohibits to set cookies and log the received cookies.
|
syntax:
|
userid_domain name | none;
|
|
default:
|
userid_domain none;
|
|
context:
|
http, server, location
|
Defines a domain for which the cookie is set.
The parameter none disables setting a domain for a cookie.
|
syntax:
|
userid_expires time | max |
off;
|
|
default:
|
userid_expires off;
|
|
context:
|
http, server, location
|
Sets a time during which a browser should keep the cookie.
The parameter max will cause the cookie to expire on
“31 Dec 2037 23:55:55 GMT”.
This is the maximum time understood by old browsers.
The parameter off will cause the cookie to expire at
the end of a browser session.
|
syntax:
|
userid_mark
letter | digit |
= |
off;
|
|
default:
|
userid_mark off;
|
|
context:
|
http, server, location
|
If parameter is not off, enables the cookie marking
mechanism and sets a character used as a mark.
This mechanism allows to add or change
userid_p3p and/or cookie expiration time while
preserving the client identifier.
The mark can be any letter of the English alphabet (case-sensitive),
digit, or the “=” character.
If a mark is set, it is compared with the first padding symbol
in the base64 representation of client identifier passed in a cookie.
If they do not match, a cookie is resent with the specified mark,
expiration time and a “P3P” header.
|
syntax:
|
userid_name name;
|
|
default:
|
userid_name uid;
|
|
context:
|
http, server, location
|
Sets a cookie name.
|
syntax:
|
userid_p3p string | none;
|
|
default:
|
userid_p3p none;
|
|
context:
|
http, server, location
|
Sets a value for the “P3P” header field that will be
sent along with a cookie.
If set to the special value none,
the “P3P” header will not be sent in a response.
|
syntax:
|
userid_path path;
|
|
default:
|
userid_path /;
|
|
context:
|
http, server, location
|
Defines a path for which the cookie is set.
|
syntax:
|
userid_service number;
|
|
default:
|
userid_service IP address of the server;
|
|
context:
|
http, server, location
|
If identifiers are issued by multiple servers (services),
each service should be assigned its own number
in order to ensure that client identifiers are unique.
For version 1 cookies the default value is zero.
For version 2 cookies this is the number composed from the last four
octets of the server’s IP address.
Embedded variables
The ngx_http_userid_module module
supports the following embedded variables:
$uid_got
-
The cookie name and received client identifier.
$uid_reset
-
If set to a non-empty string, and it is not “
0”,
client identifiers are reset.
The special value “log” additionally leads to the output of
messages about reset identifiers to the
error_log.
$uid_set
-
The cookie name and sent client identifier.
|