Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

How to set s-maxage directives for external proxies?

I’m a long time eZ Publish developer, and I’m starting to try eZ Platform / Ibexa OSS.

I’m trying to setup Symfony HTTP Cache. As per the docs, I wrapped the kernel with EzSystems\PlatformHttpCacheBundle\AppCache.

It seems to be working fine, but my issue is that any “s-maxage” directive is stripped and a “public” directive is overridden with “private”, either when set in a custom controller, a view controller, or a kernel.response listener.

This means it is impossible to set a Cache-Control: s-maxage=XXX, public header for external proxies (i.e. not controlled by the developer).

This seems to be because the following condition in EzSystems\PlatformHttpCacheBundle\AppCache is always true:

if ($variesByUser) {
	$response->setPrivate();
	$response->headers->removeCacheControlDirective('s-maxage');
	$response->headers->addCacheControlDirective('no-cache');
}

because X-User-Context-Hash is always in Vary.

Is there a way to set an s-maxage value for Symfony HTTPCache and a different one for regular public HTTP proxies?