Issue Bug Closed

#76326Viewpage module assumes HTTP if it cannot assert HTTPS.

Raoul S 05/27/16, 15:01 updated 10/27/18, 23:46

Description

In certain environments, e.g. when a load-balancer does not propagate https-information to the webserver, then the viewpage-module assumes it is in a http-environment rather than https. It then builds the url for the <iframe> with a http-scheme-prefix. This is a dangerous behaviour and all evergreen browsers block the iframe from loading.</p> <p>The following patch changes the sys-extension in a way that it does not assume any browsing-information if they cannot be determined safely. This means, the iframe will have a protocol-independent prefix &#8220;//&#8221; instead of &#8220;<a href="http://&#8221;" target="_blank" rel="noreferrer">http://&#8221;</a>.</p> <p>

$ git diff typo3_src-7.6.9/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
> diff --git a/typo3_src-7.6.9/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php b/typo3_src-7.6.9/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
index 8c27d91..848a4a2 100644
--- a/typo3_src-7.6.9/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
+++ b/typo3_src-7.6.9/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
@@ -143,12 +143,13 @@ class ViewModuleController extends ActionController
                 if (strpos($domainName, '://') !== false) {
                     $protocolAndHost = $domainName;
                 } else {
-                    $protocol = 'http';
                     $page = (array)$sysPage->getPage($finalPageIdToShow);
                     if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && GeneralUtility::getIndpEnv('TYPO3_SSL')) {
                         $protocol = 'https';
+                        $protocolAndHost = $protocol . '://' . $domainName;
+                    } else {
+                        $protocolAndHost = '//' . $domainName;
                     }
-                    $protocolAndHost = $protocol . '://' . $domainName;
                 }
             }
             return $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand . $languageParameter;
</p></iframe>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.