Patrol simplifies SSL and maintenance routing for sites built with Craft
Patrol simplifies SSL and maintenance routing for sites built with Craft CMS
primaryDomain environment config
)limitCpAccessTo environment config
)You can let users access your website during maintenance by:
Patrol > Access the site when maintenance is on
If you want to block all users, (including admins) during maintenance:
limitCpAccessTo
in your config file and login with that accountpatrol
inside your craft/plugins
directoryYou can configure Patrol from any environment definition. Here is an example of how you could go about setting that up...
// config/general.php
return [
'*' => [
'environmentVariables' => [],
],
'.dev' => [
'patrol' => [
'forceSsl' => false,
],
],
'.com' => [
'patrol' => [
'primaryDomain' => '*',
'forceSsl' => true,
'restrictedAreas' => [
'/{cpTrigger}',
'/members',
],
'maintenanceMode' => false,
'maintenanceUrl' => '/offline.html',
'authorizedIps' => [
'127.0.0.1',
],
'limitCpAccessTo' => ['[email protected]'],
'enableCpTab' => true,
'pluginAlias' => 'Patrol',
],
],
];
Patrol will throw an
HttpException(403)
for unauthorized users during maintenance if you do not have an offline page set up.
To force SSL everywhere (recommended practice), you can set
/
as the restricted area. If you only want to force SSL on the control panel, you could use/admin
or/{cpTrigger}
, the latter is recommended.
If you have questions, comments, or suggestions, feel free to reach out to me on twitter @selvinortiz
Patrol for Craft CMS is open source software, licensed under the MIT License