namespace wcf\util;
+use Psr\Http\Message\ResponseInterface;
use wcf\system\application\ApplicationHandler;
use wcf\system\event\EventHandler;
use wcf\system\request\RequestHandler;
@\header('Cache-Control: max-age=0, no-cache, no-store, must-revalidate');
}
+ /**
+ * Returns an response matching the given response with headers preventing in-browser
+ * caching attached.
+ *
+ * @since 5.5
+ */
+ public static function withNoCacheHeaders(ResponseInterface $response): ResponseInterface
+ {
+ return $response
+ ->withHeader(
+ 'cache-control',
+ [
+ 'max-age=0',
+ 'no-cache',
+ 'no-store',
+ 'must-revalidate',
+ ]
+ )
+ ->withHeader(
+ 'last-modified',
+ \gmdate('D, d M Y H:i:s') . ' GMT'
+ );
+ }
+
/**
* @deprecated 5.4 - This method is a no-op, as gzip support was removed.
*/