We're running a craftcms-backed site that uses sessions only for the admin pages.
For a few reasons, we'd like to disable session logic for all other urls:
Set-Cookieheader that craft uses to initiate a session makes responses uncacheable in our fronting cache layers
- the code path under
Craft\UserSessionServiceis unnecessary overhead for most of our logic, and occasionally adds considerable latency
We've been using
HeaderHelper::removeHeader('Set-Cookie'); on a per-controller basis to turn off this behavior, but that only gets us so far - for example,
404 responses seem to try to initiate user sessions as well, before any of our custom logic can be used:
How can we get craftcms to stop trying to set these sessions?
I should note that we're looking into getting session storage out of the filesystem and into redis, which should also help - but most of the sessions we're keeping are meaningless, and I'd rather not keep track of them at all.