All Projects → selvindev → craft-plugin-patrol

selvindev / craft-plugin-patrol

Licence: MIT license
Patrol for Craft 3

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to craft-plugin-patrol

craft-connect
Allows you to connect to external databases and perform db queries
Stars: ✭ 16 (-42.86%)
Mutual labels:  craftcms, craft-plugin, craft3
query
Run SQL queries as an admin from the Craft CMS control panel.
Stars: ✭ 14 (-50%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-router
A Craft CMS plugin for using URL segments as filtering criteria on an entry query.
Stars: ✭ 21 (-25%)
Mutual labels:  craftcms, craft-plugin, craft3
snipcart-craft-plugin
Craft e-commerce in a day.
Stars: ✭ 20 (-28.57%)
Mutual labels:  craftcms, craft-plugin, craft3
store-hours
Manage business hours with Craft CMS.
Stars: ✭ 60 (+114.29%)
Mutual labels:  craftcms, craft-plugin, craft3
craft3-forms
This craft CMS 3 form plugin makes it easy to create and use custom forms with the features the Yii 2 Framework offers. On top of this, the plugin provides even more functionalities for easy implementation of forms in twig templates.
Stars: ✭ 20 (-28.57%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-grid
A field that lets you content manage CSS Grid in Craft CMS.
Stars: ✭ 18 (-35.71%)
Mutual labels:  craftcms, craft-plugin, craft3
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+650%)
Mutual labels:  craftcms, craft-plugin, craft3
seomate
SEO, mate! It's important. That's why SEOMate provides the tools you need to craft all the meta tags, sitemaps and JSON-LD microdata you need - in one highly configurable, open and friendly package - with a super-light footprint.
Stars: ✭ 31 (+10.71%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-react
Client and Server-side React rendering for CraftCMS
Stars: ✭ 40 (+42.86%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-entry-instructions
A simple fieldtype to add instructions.
Stars: ✭ 16 (-42.86%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-typogrify
Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
Stars: ✭ 70 (+150%)
Mutual labels:  craftcms, craft-plugin, craft3
Spoon
Spoon plugin for Craft CMS - Enhance your Matrix fields with groups, tabs and more!
Stars: ✭ 82 (+192.86%)
Mutual labels:  craftcms, craft-plugin, craft3
anchors
Add anchor links to headings in your Craft CMS website content.
Stars: ✭ 47 (+67.86%)
Mutual labels:  craftcms, craft-plugin, craft3
Craft Imageoptimize
Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.
Stars: ✭ 227 (+710.71%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-audit
Audit log for Craft 3
Stars: ✭ 18 (-35.71%)
Mutual labels:  craftcms, craft-plugin, craft3
Simplemap
A beautifully simple map field type for Craft CMS.
Stars: ✭ 136 (+385.71%)
Mutual labels:  craftcms, craft-plugin, craft3
Commerce
Fully integrated ecommerce for Craft CMS
Stars: ✭ 144 (+414.29%)
Mutual labels:  craftcms, craft-plugin, craft3
craft-cookies
A simple plugin for setting and getting cookies from within Craft CMS templates.
Stars: ✭ 36 (+28.57%)
Mutual labels:  craftcms, craft-plugin, craft3
tablemaker
A user-definable table field type for Craft CMS
Stars: ✭ 39 (+39.29%)
Mutual labels:  craftcms, craft-plugin, craft3

Patrol

Patrol 3

Easy Maintenance Mode and Smart HTTPS Routing

Features 🚀

HTTPS Routing 👮‍

  • Force HTTPS (server agnostic)
  • Force a Primary Domain (naked domain vs www prefixed)
  • Define where HTTPS is enforced (if not globally)
  • Control the best redirect status code for your use case

Maintenance Mode 🚧

  • Put your site on maintenance mode
  • Define who can access the site while offline
  • Reroute guests to an offline page (or custom response)

Install

composer require selvinortiz/patrol

./craft install/plugin patrol

...or you can search for Patrol in the Plugin Store.


Configure

You can configure some stuff through the control panel, but doing so is not recommended. File configs are much more flexible and you can define different configs for different environments.

return [
    '*' => [
        'primaryDomain' => null,
        'redirectStatusCode' => 302,

        'sslRoutingBaseUrl' => "https://mysecuredwebsite.com",
        'sslRoutingEnabled' => true,
        'sslRoutingRestrictedUrls' => ['/'],

        'maintenanceModeEnabled' => false,
        'maintenanceModePageUrl' => '/offline',
        'maintenanceModeAuthorizedIps' => ['::1', '127.0.0.1'],
        'maintenanceModeResponseStatusCode' => 410,
    ],
    'dev' => [
        'sslRoutingEnabled' => false,
    ]
    'staging' => [
        'maintenanceModePageUrl' => null,
        'maintenanceModeResponseStatusCode' => 410,
    ],
    'production' => [
        'redirectStatusCode' => 301,
        'maintenanceModeResponseStatusCode' => 503,
    ]
];

Config Settings

$primaryDomain

Defaults to null

Primary domain to enforce

If your site is accessible via multiple domains, you may want to ensure that it can only be accessed by the primary domain.

Example

  • domain.frb.io (App URL)
  • www.domain.com (Secondary)
  • domain.com (Primary)

If a user requests www.domain.com or domain.frb.io, they will be redirected to domain.com

$redirectStatusCode

Defaults to 302

Redirect status code to use when...

  1. redirecting to and from SSL restricted URLs
  2. redirecting to primary domain, if one is defined.

$sslRoutingBaseUrl

Defaults to Craft::$app->request->hostInfo

Tells Patrol what base URL to use when redirecting to SSL

$sslRoutingEnabled

Defaults to false

Tells Patrol to force requests to be made over https://

$sslRoutingRestrictedUrls

Defaults to ['/'] (everything)

Tells Patrol where https:// should be enforced.

$maintenanceModeEnabled

Defaults to false

Tells Patrol that your site is on maintenance mode and it should start routing traffic differently.

Authorized users will see your site while unauthorized users will see either your offline page or an HTTP response with a custom status code.

$maintenanceModeAuthorizedIps

Defaults to ['::1', '127.0.0.1']

IP addresses that should be allowed (without being logged in) during maintenance.

$maintenanceModeResponseStatusCode

Defaults to 410

Tells Patrol what kind of HttpException to throw if you do not set a $maintenanceModePageUrl.

$maintenanceModeAccessTokens

Defaults to []

Access tokens that can be used to automatically add an IP to the allowed list.

If you define the following access tokens:

$maintenanceModeAccessTokens =  [
    'ceo-access-token',
    'd0nn3bd8a2iza1ikjxxdo28iicabh7ts',
];

You will be able to send someone a link with the access token. When the visit that link, their IP will be added to the allowed list.

You can use any string as an access token but avoid using spaces.

If you are planning on using access tokens, do not include $maintenanceModeAuthorizedIps as a file config setting.


Help & Feedback

If you have questions, comments, or suggestions, feel free to reach out to me on twitter @selvinortiz

License

Patrol for Craft CMS is open source software

MIT License

osi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].