Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-32020: make /_ez_http_invalidatetoken cached by varnish #137

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Controller/InvalidateTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use Symfony\Component\HttpKernel\EventListener\SessionListener;

class InvalidateTokenController
{
Expand Down Expand Up @@ -74,6 +75,8 @@ public function tokenAction(Request $request)
$headers->set('X-Invalidate-Token', $this->configResolver->getParameter('http_cache.varnish_invalidate_token'));
$response->setSharedMaxAge($this->ttl);
$response->setVary('Accept', true);
// header to avoid Symfony SessionListener overwriting the response to private
$response->headers->set(SessionListener::NO_AUTO_CACHE_CONTROL_HEADER, 1);

return $response;
}
Expand Down