Error : The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is highly recommended that you configure this. See Protecting against HTTP HOST Header attacks for more information.
Solution :
Open the settings.php file and insert the following code snippets based on your application requirements:
a. For Localhost Setup:
If your application is running on a local server (e.g., XAMPP or WAMP), and the URL starts with http://localhost/project, include the localhost configuration in the settings.
b. Multiple URLs Support:
Users can define and include any number of URLs as needed for their setup.
c. Subdomain Handling:
If your application uses multiple subdomains, you can enable support for all subdomains under a specific domain (e.g., dev.com) using a regular expression like ^.+\.dev\.com. This configuration ensures that all subdomains under dev.com are accepted.
d. Specific Domain Access:
To allow access to your application from a specific domain, such as devprod.com, include the corresponding configuration to explicitly accept requests from that domain.
$settings['trusted_host_patterns'] = [
'^localhost$',
'^.+\.dev\.com$',
'^devprod\.com$'
];
Comments
Post a Comment