[BUGFIX] Always prefer HTTPS for cross-domain links 82/57082/2
authorMathias Brodala <mbrodala@pagemachine.de>
Tue, 29 May 2018 14:17:23 +0000 (16:17 +0200)
committerMathias Brodala <mbrodala@pagemachine.de>
Wed, 30 May 2018 07:47:39 +0000 (09:47 +0200)
This expands the logic for forced absolute URLs to all cases and
ensures HTTPS is kept for cross-domain links if possible.

Resolves: #85111
Releases: master, 8.7
Change-Id: I7840a47d0ae9a3f9571ae8ddcf9cdc35b59cc4fa
Reviewed-on: https://review.typo3.org/57082
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php

index 8061c4b..b173200 100644 (file)
@@ -161,14 +161,12 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
             }
             unset($params);
         }
-        $absoluteUrlScheme = 'http';
+        $absoluteUrlScheme = GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https' : 'http';
         // URL shall be absolute:
         if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl']) {
             // Override scheme:
             if (isset($conf['forceAbsoluteUrl.']['scheme']) && $conf['forceAbsoluteUrl.']['scheme']) {
                 $absoluteUrlScheme = $conf['forceAbsoluteUrl.']['scheme'];
-            } elseif (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
-                $absoluteUrlScheme = 'https';
             }
             // If no domain records are defined, use current domain:
             $currentUrlScheme = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);