You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https) #680
When installing TYPO3 9 for the first time on ddev using https, an warning is thrown during installation wizard.
Trusted hosts pattern mismatch
The trusted hosts pattern will be configured to allow all header values. This is because your $SERVER_NAME:[defaultPort] is "typo3-master-intro.ddev.local:443" while your HTTP_HOST:SERVER_PORT is "typo3-master-intro.ddev.local:80". Check the pattern defined in Install Tool -> All configuration -> System -> trustedHostsPattern and adapt it to expected host value(s).
What you expected to happen:
No warning - as it is when installing using http.
How to reproduce this:
clone TYPO3 repo, run composer install, ddev config, ddev start, and follow the install wizard
Version: Please include the output of ddev version, docker version and the project's .ddev/config.yaml.
The issue exists in both default image and the new:
drud/nginx-php-fpm-local:20180224_multi_cms_nginx
Anything else do we need to know:
Related source links or issues:
Please use a complexity rating of 1-5 (5 is high) for a feature request. (High complexity implies more PR planning)
this is a sign of a suboptimal server config.
The trustedhostsPattern setting was introduced to mitigate "Host Spoofing" security issue https://typo3.org/teams/security/security-bulletins/typo3-core/typo3-core-sa-2014-001/
"
TYPO3 checks the currently submitted host-header against the SERVER_NAME variable.
The SERVER_NAME variable contains trusted values in the following cases:
Nginx Webserver: Nginx is set up with different servers blocks while the TYPO3 installation is not part of the "catch all" server block. By default only the first value of the server_name option is taken into account to populate the SERVER_NAME variable. If you specified more than one server name in your Nginx configuration you have to additionally add the following configuration:
fastcgi_param SERVER_NAME $host;
"
In this case I see that SERVER_NAME seems correct, however the port is the issue.
and life is good, and of course you can add multiple patterns.
I'm quite sure that we can support TYPO3 the same way with $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] right? Does it take a regex, can we just add a regex in AdditionalConfiguration.php that glosses over the port number and such?
changed the title [-]Warning when installing TYPO3 9 with HTTPS[/-][+]Local settings for Drupal 8 and TYPO3 needs to support trusted_host patterns (and with https)[/+]on Feb 28, 2018
changed the title [-]Local settings for Drupal 8 and TYPO3 needs to support trusted_host patterns (and with https)[/-][+]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]on Feb 28, 2018
Yes, TYPO3 also allows you to use regex in $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'], and yes, you can add it to the AdditionalConfiguration. However if sever config is fully correct, you don't have to modify trustedHostsPattern.
So as a workaround we can set in AdditionalConfiguratuion sth like (untested):
The issue here is the following:
With the default configuration, TYPO3 looks, whether the HTTP Header "Host" matches the SERVER_NAME, assuming the latter cannot be modified.
That check passes. But there is another check.
It is checked whether the port passed with the HTTP Header, also matches SERVER_PORT.
If no port was passed, default ports are assumed
if HTTPS is on (determined from Env, or proxy settings), then default port is assumed to be 443, otherwise 80
Now with ddev (and other ssl terminating setups), the backend server is never requested via HTTPS, but with HTTP and thus port 80 is used.
But apparently, HTTPS is set to "on".
To TYPO3 this now looks like a fake/invalid request (HTTPS without port set, cannot be requested over port 80) and it is rejected
changed the title [-]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/-][+]Critical: Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]on Mar 29, 2018
Escalating the priority given that this is causing bigger issues with our TYPO3 (summarized by @tmotyl in the issue summary). A couple of other notes with @rfay. This may require additional help from the TYPO3 community. Currently, this may require either 1) moving the port inside the web container back to port 80 (there are still problems with this) or 2) modifications to the default TYPO3 nginx configuration.
changed the title [-]Critical: Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/-][+]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]on Apr 2, 2018
+1 on this: it would be nice if the Drupal 8 auto-generated settings.local.php had a correct trusted_host_patterns value so that we don't need to add the *.ddev.local domain to our version-controlled settings.php.
Activity
rfay commentedon Feb 27, 2018
@tmotyl isn't this a TYPO3 issue, not ddev?
Or would it be possible to add some context in the AdditionalConfiguration.php that would work around this?
tmotyl commentedon Feb 28, 2018
this is a sign of a suboptimal server config.
The trustedhostsPattern setting was introduced to mitigate "Host Spoofing" security issue
https://typo3.org/teams/security/security-bulletins/typo3-core/typo3-core-sa-2014-001/
"
TYPO3 checks the currently submitted host-header against the SERVER_NAME variable.
The SERVER_NAME variable contains trusted values in the following cases:
Nginx Webserver: Nginx is set up with different servers blocks while the TYPO3 installation is not part of the "catch all" server block. By default only the first value of the server_name option is taken into account to populate the SERVER_NAME variable. If you specified more than one server name in your Nginx configuration you have to additionally add the following configuration:
fastcgi_param SERVER_NAME $host;
"
In this case I see that SERVER_NAME seems correct, however the port is the issue.
rfay commentedon Feb 28, 2018
Drupal8 has $settings['trusted_host_patterns'], https://www.drupal.org/node/1992030 - And it allows a regex. We absolutely need to add that to the settings.local.php for D8. But there you can add just
and life is good, and of course you can add multiple patterns.
I'm quite sure that we can support TYPO3 the same way with
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern']right? Does it take a regex, can we just add a regex in AdditionalConfiguration.php that glosses over the port number and such?[-]Warning when installing TYPO3 9 with HTTPS[/-][+]Local settings for Drupal 8 and TYPO3 needs to support trusted_host patterns (and with https)[/+][-]Local settings for Drupal 8 and TYPO3 needs to support trusted_host patterns (and with https)[/-][+]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]tmotyl commentedon Feb 28, 2018
Yes, TYPO3 also allows you to use regex in
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'], and yes, you can add it to the AdditionalConfiguration. However if sever config is fully correct, you don't have to modify trustedHostsPattern.So as a workaround we can set in AdditionalConfiguratuion sth like (untested):
rfay commentedon Feb 28, 2018
Right, but we'd want ddev with typo3 to work with both http and https right? Can that even be done without adding to the trustedHostsPattern?
rfay commentedon Mar 28, 2018
Another note from @helhum about typo3:
More on https://typo3.slack.com/archives/C8TRNQ601/p1522263659000324?thread_ts=1522226950.000339&cid=C8TRNQ601
[-]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/-][+]Critical: Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]rickmanelius commentedon Mar 30, 2018
Escalating the priority given that this is causing bigger issues with our TYPO3 (summarized by @tmotyl in the issue summary). A couple of other notes with @rfay. This may require additional help from the TYPO3 community. Currently, this may require either 1) moving the port inside the web container back to port 80 (there are still problems with this) or 2) modifications to the default TYPO3 nginx configuration.
[-]Critical: Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/-][+]Local settings for Drupal 8 and TYPO3 need to support trusted_host patterns (and with https)[/+]10 remaining items
decafdennis commentedon May 7, 2018
+1 on this: it would be nice if the Drupal 8 auto-generated
settings.local.phphad a correcttrusted_host_patternsvalue so that we don't need to add the*.ddev.localdomain to our version-controlledsettings.php.rfay commentedon May 7, 2018
Thanks for your vote, we'll have it before long, it's so easy. And PRs are welcome.