Contensio logo

Maintenance Mode

Maintenance mode for Contensio — custom message page with IP whitelist and admin bypass.

About this plugin

Maintenance Mode

Puts your Contensio site into maintenance mode with a custom message page. Visitors see a styled 503 page; the admin panel remains fully accessible.


Requirements

  • Contensio 2.0 or later

Installation

Composer

composer require contensio/plugin-maintenance-mode

No migrations required.


How it works

The plugin registers MaintenanceMiddleware into the web middleware group. On every incoming GET request it checks:

  1. Is this an admin or auth route? (/account/*, /login, /register, etc.) → pass through
  2. Is maintenance mode disabled? → pass through
  3. Is the visitor's IP in the whitelist? → pass through
  4. Is the visitor logged in and "bypass logged-in admins" is enabled? → pass through
  5. Otherwise → return maintenance.blade.php with HTTP 503 + Retry-After: 3600

POST / PUT / DELETE requests are never intercepted - forms and API calls continue to work during maintenance.


Configuration

Go to Admin > Settings > Maintenance Mode.

Setting Default Description
Enabled off Toggle maintenance mode on/off
Page title Under Maintenance <h1> on the maintenance page
Message (default text) Body copy shown to visitors
Bypass logged-in admins on Logged-in users with admin access see the real site
IP whitelist (empty) One IP per line - always bypasses maintenance

Settings are stored in the core settings table (module = plugin_maintenance, setting_key = config).


Bypassing maintenance

Three ways a visitor can bypass the maintenance page:

1. IP whitelist Add the visitor's IP (one per line) in the admin settings. The settings page shows your current IP for convenience.

2. Logged-in admin If "Bypass logged-in admins" is enabled (default), any user with admin panel access (canAccessAdmin()) sees the real site.

3. Direct URL access The admin panel (/account/*) and all auth routes are always accessible, regardless of maintenance state.


Maintenance page customisation

Override the Blade view in your theme or app:

resources/views/vendor/maintenance-mode/maintenance.blade.php

Available variable: $config (array with title, message, and all other settings).

The default maintenance page is a standalone HTML page - it does not extend the site layout - so it renders correctly even if your theme has broken assets.


Programmatic control

use Contensio\Plugins\MaintenanceMode\Support\MaintenanceConfig;

// Check status
$isActive = MaintenanceConfig::get('enabled');  // bool

// Enable via code
MaintenanceConfig::save(['enabled' => true, ...MaintenanceConfig::all()]);

Bypassed URL prefixes

These prefixes always bypass the middleware (hardcoded):

account, login, logout, register, forgot-password, reset-password, email, two-factor, user, _ignition, _debugbar, api, sanctum, livewire