Review 13.4 Merged

88704[BUGFIX] Use X-Forwarded-Proto header when checking for HTTPS

Benjamin Franzke CR +2 V +2 Normal +163 −15 updated 03/24/25, 12:03

Commit message

TYPO3 ships with two (main) options for having TYPO3 running
behind a reverse proxy.

  $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP']

and

  $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxySSL']

The latter "reverseProxySSL" is used to tell TYPO3
which reverse proxies actually handle the SSL termination,
and ensure that only HTTPS/TLS/SSL connection are
established when the client is talking to the proxy.
The proxy / SSL terminator then builds a non SSL connection
to the app server / TYPO3.

The former "reverseProxyIp" can be used for clients
to connect via HTTP or HTTPS, so TYPO3 previously just
checked for HTTPS=on. But TYPO3 needs to know if the client
had established a secure connection, for this, the Header
X-Forwarded-Proto is available, see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Proto
for more details.

This change now evaluates X-Forwarded-Proto if the
connection comes through a valid reverseProxyIp
proxy, and only in this case, because at this point
TYPO3 does not know if we have SSL or not.

In case the header is not sent, TYPO3 uses SSL evaluation
as before.

It is **essential** to evaluate X-Forwarded-Proto ONLY
when we can trust the connection to the reverseProxyIp
and otherwise never.

See also: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65550

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 1

Files 4

Review log 34

  1. Benjamin Franzke commented on patch set 1 03/24/25, 11:53

    Cherry Picked from branch main.
  2. Benjamin Franzke voted on patch set 1 CR +2 V +2 03/24/25, 11:58

  3. core-ci voted on patch set 1 V +1 03/24/25, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76145

  4. Benjamin Franzke merged patch set 2 03/24/25, 12:03