Flexible SSL is not supported anymore and crashes with 1396795884
Flexible SSL is a way to use CloudFlare as a SSL-proxy meaning your visitors are using a SSL-based connection (https://) up to the CloudFlare proxy servers but then CloudFlare connects to the standard port 80 on your (publicly hidden) web server.
Since the release of TYPO3 4.7.19, 6.0.14, 6.1.9 and 6.2.3 a new configuration setting has been added to define the trustedHost, see #30377 for details.
If the website is using flexible SSL, some global SERVER variables are overridden, namely:
$_SERVER['HTTPS'] = 'on'; $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
but since the upgrade, and when using default settings, TYPO3 crashes with exception 1396795884 since
$_SERVER['SERVER_PORT'] is 80 but
TYPO3_SSL is TRUE and thus port 443 is expected!
The quick fix is to manually set the configuration option trustedHostPatterns in your
// Needed when using flexible SSL on CloudFlare $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = 'www\\.your-domain\\.com';
To fix this bug we will override
$_SERVER['SERVER_PORT'] as well, because it should not have any other side-effect than "fixing" the broken TYPO3 :)