Invalid trusted host value stops Mautic from working

Your software
My Mautic version is: unknown – I’m locked out
My PHP version is: 7.1

Your problem
I added an invalid value to the Trusted Hosts list in my configuration. Saving the change immediately locked me out of my Mautic site.

There is an old (closed) thread on GitHub which is discussing this same problem that I have. There is a somewhat incomplete solution posted, but requests for more detail went unanswered.

GitHub thread: https://github.com/mautic/mautic/issues/4315

These errors are showing in the log:
Line 1: [2020-05-10 03:02:53] mautic.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: “Untrusted Host “mautic.xyz.info”” at /var/www/html/mautic/vendor/symfony/http-kernel/EventListener/RouterListener.php line 120 {“exception”:"[object] (Symfony\Component\HttpKernel\Exception\BadRequestHttpException(code: 0): Untrusted Host “mautic.xyz.info” at /var/www/html/mautic/vendor/symfony/http-kernel/EventListener/RouterListener.php:120, UnexpectedValueException(code: 0): Untrusted Host “mautic.xyz.info” at /var/www/html/mautic/app/bootstrap.php.cache:950)"}

Steps I have tried to fix the problem:
The suggested solution on Github was:
The solution in this scenario was to edit the local.php file in app/config and then manually clear the cache.

I found the offending line in:
var/www/html/mautic/app/config/local.php

I recognize the incorrect domain I entered by mistake. So I have changed that back to the correct domain.

The second part of the suggested solution is: “…then manually clear the cache.” I renamed the app/cache directory, rather than deleting it.

I tried to reset permissions and got a message saying “cannot access ‘/var/www/html/mautic/’”

I tried to restart Apache and got the message. “Failed to restart apache2.service: Unit apache2.service not found”.

If I access the site with the IP address, I get the Apache2 Ubuntu Default Page, which says:
If you can read this page, it means that the Apache HTTP server installed at this site is working properly.

The error persists, and I’m completely lost. Any help much appreciated.

3 posts were merged into an existing topic: Untrusted Host error

A post was merged into an existing topic: Untrusted Host error