Project

General

Profile

Actions

Feature #32343

closed

Default value for url_scheme

Added by Felix Nagel almost 13 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2011-12-06
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
medium
Sprint Focus:

Description

Problem:
We want to use https for some pages. Setting url_scheme on these pages together with a TS config like this:

[globalVar = TSFE:page|url_scheme = 2] && [globalString = _SERVER|HTTPS=on]    
    config.baseURL = https://youdomain.com
[global]

works nice so far but the scheme will not change back to http when navigating to non https pages. As we change the baseURL on the calling page, all links to other pages will be linked with https regardless we set these pages to https or not (via url_scheme field).
Changing the baseURL is needed as we want all resources to be https not only the page (html file) itself.

Solution:
We need a default scheme so we could check if its needed to change the scheme for specific links.
Add these lines before checking for url_scheme and forceAbsoluteUrl (about line 5793, file typo3\sysext\cms\tslib\class.tslib_content.php, function typoLink):

$requestUrlScheme = parse_url(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
if (!(isset($conf['forceAbsoluteUrl.']['scheme']) && $conf['forceAbsoluteUrl.']['scheme']) && 
        $page['url_scheme'] == 0 && strlen($GLOBALS['TSFE']->config['config']['defaultUrlScheme']) > 0 && $requestUrlScheme != $GLOBALS['TSFE']->config['config']['defaultUrlScheme']) {
    $conf['forceAbsoluteUrl'] = 1;
    $conf['forceAbsoluteUrl.']['scheme'] = $GLOBALS['TSFE']->config['config']['defaultUrlScheme'];
}

Now its possible to use "page.config.defaultUrlScheme = http" to set a default value.
Please note that Ive attached a demo extension (XCLASS) which works pretty nice so far.

Ideas:
It would be awesome to set TS anywhere in the sitetree to force a scheme. This would require the TS config of the linked page which is not available in function typoLink. Im not aware if there is a nice (non performance killing) solution.

Please note: there is a mailinglist thread discussing this issue, search for "Scheme enforcement in 4.5.x" in typo3 dev


Files

T3X_https45-0_0_1.t3x (9.58 KB) T3X_https45-0_0_1.t3x Felix Nagel, 2011-12-06 18:10
T3X_https45-0_0_2.t3x (9.63 KB) T3X_https45-0_0_2.t3x Felix Nagel, 2011-12-08 16:05
T3X_https45-0_0_3-z-201201101755.t3x (9.84 KB) T3X_https45-0_0_3-z-201201101755.t3x Felix Nagel, 2012-01-10 17:55
https46.diff (1.22 KB) https46.diff Alexander Achenbach, 2012-03-28 18:07

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #82797: PageLinkBuilder uses $absoluteUrlScheme outside of forceAbsoluteUrl but the scheme can only be changed when using forceAbsoluteUrlClosedWolfgang Klinger2017-10-18

Actions
Has duplicate TYPO3 Core - Feature #46064: tslib_cObj->typoLink() does not check for a default url_schemeClosed2013-03-06

Actions
Actions

Also available in: Atom PDF