This very tiny plugin puts October in HTTPS protocol correctly when behind the Cloudflare reverse proxy in full or flexible SSL mode. In addition, it ensures IP detection functions as expected when using Cloudflare in conjunction with a load balancer.
Features
Rocket Loader Protection
Cloudflare Rocket Loader rewrites script tags to defer their execution, which can break scripts that depend on a strict loading order, including the October CMS backend and AJAX framework. This plugin marks every rendered script tag with the data-cfasync="false" attribute, instructing Rocket Loader to leave them untouched.
Protection is applied to the backend area by default, where the script loading order is critical. The frontend is left untouched so Rocket Loader can keep optimizing theme scripts, and if your theme is affected, enable the frontend protection using the configuration below.
Trusted Proxies
Puts October CMS in the HTTPS protocol correctly when behind the Cloudflare reverse proxy in full or flexible SSL mode. In addition, it ensures IP detection functions as expected when using Cloudflare in conjunction with a load balancer.
This works by registering the published Cloudflare address ranges as trusted proxies so the client IP address and HTTPS scheme are detected from the forwarded request headers.
Installation via Command Line
php artisan plugin:install RainLab.Cloudflare
Configuration
To override the default configuration, create a file named config/rainlab/cloudflare/config.php in your project and return only the values you want to change.
<?php
return [
'ignore_frontend_scripts' => true,
];
The following configuration values are supported.
| Key | Description | Default |
|---|---|---|
ignore_backend_scripts |
Adds data-cfasync="false" to script tags rendered in the backend area. |
true |
ignore_frontend_scripts |
Adds data-cfasync="false" to script tags rendered on the frontend. |
false |
trust_proxies |
Registers the Cloudflare network as trusted proxies. | true |
proxy_addresses |
The proxy address ranges to trust. | Cloudflare ranges |
The boolean values can also be set with environment variables.
CLOUDFLARE_IGNORE_BACKEND_SCRIPTS=true CLOUDFLARE_IGNORE_FRONTEND_SCRIPTS=true CLOUDFLARE_TRUST_PROXIES=true
-
Nathan Smith
Found the plugin useful on 18 Dec, 2020
Had an issue with not being able to load staticpages/blogs/smallrecords etc, this plugin was the fix. Saved me a bunch of time. Many thanks
-
Ronny Skog
Found the plugin useful on 29 Mar, 2019
Seems to be working well.
-
Ompmega
Found the plugin useful on 7 Dec, 2018
Works without issues
-
| 1.0.1 |
First version of Cloudflare Apr 08, 2017 |
|---|