Issue Bug Closed

#107891Multiple Cache-Control Header

Peter Kraume 10/28/25, 15:08 updated 03/31/26, 09:00

Description

In several of our projects we detected multiple cache-control headers.

This is problematic because it can lead to inconsistent behavior:
Not all proxies, CDNs, or browsers handle this consistently. Some:

  • Only use the first header
  • Only use the last header
  • Combine them correctly
  • Throw an error

Example Header:

> ➜ ~ curl -I https://www.domain.tld
> HTTP/2 200
> server: nginx
> date: Tue, 28 Oct 2025 11:07:58 GMT
> content-type: text/html; charset=utf-8
> content-length: 22911
> vary: Accept-Encoding
> content-language: de-DE
> *cache-control: private, no-store*
> strict-transport-security: max-age=31536000; includeSubDomains
> *cache-control: max-age=0*
> expires: Tue, 28 Oct 2025 11:07:58 GMT
> x-ua-compatible: IE=edge
> x-content-type-options: nosniff
> x-xss-protection: 1; mode=block
> x-frame-options: SAMEORIGIN
> referrer-policy: same-origin
> permissions-policy: geolocation=(), camera=(), microphone=(), payment=()
> x-cache-status: MISS

In the TypoScriptFrontendController TYPO3 already defines cache-control: private, no-store
https://github.com/TYPO3/typo3/blob/a81e2d39c61db71af75ba3eb18089f029c9a9009/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php#L470C14-L470C15

And the default .htaccess, which is shipped with TYPO3, adds the second header:
https://github.com/TYPO3/typo3/blob/a81e2d39c61db71af75ba3eb18089f029c9a9009/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess#L132C63-L132C77

Possible solution:

Add this after the line ExpiresByType text/x-cross-domain-policy "access plus 1 week" :

<FilesMatch "\.(php|html?)$">
    ExpiresActive Off
</FilesMatch>

Reviews 2

History 310

  1. Peter Kraume commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-02-25T21:00:11+00:00" > 02/25/26, 21:00 </span>

    Applied in changeset commit:1cb5d2f1d6247aec2b1392c58083500ccc496e68.