Sessions and cookies
This page is for administrators. A stolen session cookie is as good as the password. Exponential sets safe cookie flags by default and signs other sessions out when a password changes; a few settings make it stricter (13.7 Sessions and cookies).
Contents
- The defaults
- Recommended for an HTTPS-only site
- Separate cookies for the administration
- Signing users out
- Pitfalls
- Related pages
The defaults
settings/site.ini [Session] (the cookie keys are commented out; their defaults apply):
| Key | Default | Meaning |
|---|---|---|
CookieSecure | auto | Secure when the request came over HTTPS |
CookieHttponly | true | scripts cannot read the cookie |
CookieSameSite | Lax | not sent with most cross-site requests |
SessionTimeout | 31104000 | seconds (360 days) |
RememberMeTimeout | 31104000 | seconds (360 days); Remember me is checked by default |
SessionNameHandler | default | custom gives every siteaccess its own cookie |
Also: a new session id at sign-in; logging out ends the session for good; a password change signs out every other
session of the user (EndOtherSessions=enabled); a disabled account's sessions end at their next request.
Recommended for an HTTPS-only site
# settings/override/site.ini.append.php
[Session]
CookieSecure=true
CookieHttponly=true
CookieSameSite=Lax
SessionTimeout=28800and in PHP's configuration session.use_strict_mode=1. Choose the timeout with your editors: a short one limits how
long a stolen session is useful, but signs out people who work slowly.
Separate cookies for the administration
[Session]
SessionNameHandler=custom
SessionNamePrefix=eZSESSID
SessionNamePerSiteAccess=enabledA sign-in on the public site (for example a member area) is then not a sign-in in the administration.
Signing users out
- After a suspected compromise of one account: change its password; every other session ends at its next request. Disable the account if needed (Users > Check user accounts, Disable).
- Everybody: with the database session handler (
[Session] Handler=ezpSessionHandlerDB), Setup > Sessions lists and removes sessions, with a confirmation (Sessions). With the default handler the page cannot remove sessions one by one; switching handler signs everybody out once. - Removing a session does not block the user; disable the account or change the password as well.
Pitfalls
CookieSecure=truebehind an HTTPS proxy that is not trusted: users are signed out on every page. ConfigureTrustedProxies[](see "Proxies and trusted headers").CookieSameSite=Strictdrops the session on the first click from an e-mail into a signed-in page.CookieSameSite=Noneis honored only together withSecure.
Related pages
- 13.7 Sessions and cookies
- Sessions: who is signed in
- Security hardening: Session hijacking
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.