You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 13, 2021. It is now read-only.
This library works like a charm but there was an issue that kept me hitting a wall. It'd be nice if it was mentioned somewhere in the README file.
PHP session handler generates its own headers. The exact ones depend on the session.cache_limiter directive. Its default value is nocache and that means you get:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
This interferes completely with \Micheh\Cache\CacheUtil::withCache(). Only Cache-Control finally gets the value set by this method. It's also not obvious at first sight because these extra headers are set by PHP core and are invisible for PSR-7 implementations (at least the one I'm using).
It's not necessarily the library's fault but it can lead you to wonder why it isn't working. If you want to cache responses from session based applications you need to set session.cache_limiter to something that's not the default, e.g.:
This is actually quite a big deal. I'm not really using this library at the moment (although I think I will) but I came across this post which solved my issue with a PSR-7 lib not properly setting Cache-Control because I have sessions started. Thank you for pointing this out.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This library works like a charm but there was an issue that kept me hitting a wall. It'd be nice if it was mentioned somewhere in the README file.
PHP session handler generates its own headers. The exact ones depend on the
session.cache_limiter
directive. Its default value isnocache
and that means you get:This interferes completely with
\Micheh\Cache\CacheUtil::withCache()
. OnlyCache-Control
finally gets the value set by this method. It's also not obvious at first sight because these extra headers are set by PHP core and are invisible for PSR-7 implementations (at least the one I'm using).It's not necessarily the library's fault but it can lead you to wonder why it isn't working. If you want to cache responses from session based applications you need to set
session.cache_limiter
to something that's not the default, e.g.:Reference can be found at
session_cache_limiter()
manual page.The text was updated successfully, but these errors were encountered: