Dolibarr/dolibarr · warning
Sorry, your application is offline. Only administrator users
Error message
Sorry, your application is offline. Only administrator users (${MAIN_ONLY_LOGIN_ALLOWED}) is allowed to connect for the moment. What it means
Same maintenance restriction, but reached when the request has no session at all (e.g. API clients, new visitors). Dolibarr prints that only administrator users from MAIN_ONLY_LOGIN_ALLOWED may connect, with a link to the login page.
Solutions
- Clear MAIN_ONLY_LOGIN_ALLOWED after maintenance completes
- Use an allowed admin login for programmatic access
- For bots/health checks, exempt them or point them at a page that defines NOLOGIN/NOREQUIREUSER consistently
Defensive patterns
Strategy: retry
Prevention
- Monitor the flag MAIN_ONLY_LOGIN_ALLOWED so it isn't forgotten
- Use a dedicated admin account for API access during maintenance windows
- Point health checks at endpoints that bypass the restriction legitimately
When it happens
Trigger: MAIN_ONLY_LOGIN_ALLOWED set; request without a dol_login session (fresh visitor, REST client, cron using a non-allowed account).
Common situations: Monitoring/health checks hitting pages during maintenance; API integrations broken while MAIN_ONLY_LOGIN_ALLOWED is enabled; forgotten maintenance flag after upgrade.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- Sorry, your application is offline.
- You are logged with user
- Access refused by IP protection. Your detected IP is
- Bad link. File is from another module part.
- If define NOREQUIREDB or NOREQUIRETRAN are set, you must…
AI-assisted analysis of Dolibarr/dolibarr@598aa4bdad (2026-09-14).
Data as JSON: /api/errors/b2ef1fad02395138.
Report an issue: GitHub.
Appendix: source
Thrown at htdocs/main.inc.php:197
if ((!session_id() || !isset($_SESSION["dol_login"])) && !isset($_POST["username"]) && !empty($_SERVER["GATEWAY_INTERFACE"])) {
$ok = 1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin)
} elseif (isset($_POST["username"]) && in_array($_POST["username"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
$ok = 1; // We let working pages that is a login submission (login submit, to allow login by admin)
} elseif (defined('NOREQUIREDB')) {
$ok = 1; // We let working pages that don't need database access (xxx.css.php)
} elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) {
$ok = 1; // We let working pages that ask to work even if only login enabled (logout.php)
} elseif (session_id() && isset($_SESSION["dol_login"]) && in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
$ok = 1; // We let working if user is allowed admin
}
if (!$ok) {
if (session_id() && isset($_SESSION["dol_login"]) && !in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
print 'Sorry, your application is offline.'."\n";
print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
$nexturl = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);
print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
} else {
print 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
$nexturl = dolBuildUrl(DOL_URL_ROOT . '/');
print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
}
exit;
}
}
// Activate end of page function
register_shutdown_function('dol_shutdown');
// Load debugbar
if (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) {
global $debugbar;
include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php';
$debugbar = new DolibarrDebugBar();
$renderer = $debugbar->getJavascriptRenderer();
if (!getDolGlobalString('MAIN_HTML_HEADER')) {View on GitHub (pinned to 598aa4bdad)