[BUGFIX] Always prefer HTTPS for cross-domain links 86/57086/2
authorMathias Brodala <mbrodala@pagemachine.de>
Tue, 29 May 2018 14:17:23 +0000 (16:17 +0200)
committerMathias Brodala <mbrodala@pagemachine.de>
Wed, 6 Jun 2018 13:35:12 +0000 (15:35 +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/57086
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php

index 0a4262a..4fd92ad 100644 (file)
@@ -157,14 +157,12 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
             }
             unset($params);
         }
             }
             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'];
         // 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);
             }
             // If no domain records are defined, use current domain:
             $currentUrlScheme = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);