code711 / updatetrutstedhostsfromsite
TYPO3 Extension to automatically update the $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] setting based on the configured sites
Installs: 1 077
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:typo3-cms-extension
Requires
- php: 7.4.*||8.0.*||8.1.*||8.2.*
- code711/siteconfigurationevents: ^1.0
- typo3/cms-core: 11.5.*||^12.0
Requires (Dev)
- friendsoftypo3/phpstan-typo3: ^0.9
- helhum/typo3-console: *
- typo3/cms-backend: ^12.0
- typo3/cms-frontend: ^12.0
- typo3/cms-install: ^12.0
- typo3/cms-lowlevel: ^12.0
- typo3/cms-tstemplate: ^12.0
- typo3/coding-standards: ^0.5
- vimeo/psalm: ^4.10
README
This TYPO3 extension will automatically update the $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] variable when changes to the Site Configurations are made, reflecting the used domains in the system.
This is achieved with the Extension EXT:siteconfigurationevents which provides PSR-14 events when changing the Site config in the backend.
Additionally a command for CLI is available to update the trusted host pattern from the shell or during CI/CD or as a scheduler task via cron.
./vendor/bin/typo3 code711:updatetrustedhostfromsites -h ✔ 10118 16:52:23 Description: update SYS/trustedHostsPattern based on the site configuration Usage: code711:updatetrustedhostfromsites Options: -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Calling the command with -v or --verbose will print the new value to the console additionaly to setting it in the config.
Installation
composer req code711/updatetrustedhostfromsites
Configuration
to date no configuration options are available
Remarks
This extension WILL yield to the TYPO3_CONTEXT (or other similar) Environment Variable if Variations in the Site Configs are set.
A . will not be escaped (as it should be). This is a limitation as the escape character \ would be escaped again by the exporter somehow.