Incorrect access detected error

You may encounter an error stating the following:

'Incorrect access detected, this server may be accessed only through "" address, sorry. Please notify server administrator.'

This typically happens when the web server URL configuration is not set up correctly.

Follow these steps to troubleshoot the issue:

  1. Double-check the correct address has been added to $CFG->wwwroot in config.php. If the site's address has been updated, you may have forgotten to update it here.

  2. If the config.php file is correct, check to see if the URL configuration has been set up correctly. This differs depending on the web server e.g. Apache, IIS, etc., and will need to be checked by a server administrator.

  3. In some cases port forwarding might be used. Adding $CFG->reverseproxy = true; to config.php may resolve the issue.

    This configuration setting can found in config-dist.php and the information is as follows:

    // Enable when setting up advanced reverse proxy load balancing configurations,

    // it may be also necessary to enable this when using port forwarding.

    //      $CFG->reverseproxy = true;