dev-master
9999999-devLaravel framework Service Provider to automatic loading IP ranges of Cloudflare trust proxies.
MIT
The Requires
- php >=5.6.4
- illuminate/support ~5.0
by Łukasz Adamski
laravel framework proxy cloudflare proxies trust
Laravel framework Service Provider to automatic loading IP ranges of Cloudflare trust proxies.
The package is developed to provide Cloudflare trust proxies support for Laravel Framework requests. List of IP ranges used by Cloudflare can be found here: (https://www.cloudflare.com/ips/)., (*1)
composer require lukasz-adamski/laravel-cloudflare
config/app.php
:Adams\Cloudflare\CloudflareServiceProvider::class,
app/Http/Kernel.php
. You can put this middleware where you want but if project is hosted with Cloudfare Reverse Proxy it is preferable to register it for all requests in $middleware
variable.\Adams\Cloudflare\Moddleware\TrustProxies::class,
php artisan cloudflare:reload
This package will not load Cloudflare IPs automatically. To do this you can use two registered commands:
* cloudflare:reload
- this command loads list of current Cloudflare Proxy IPs and store in application cache forever,
* cloudflare:view
- this command show list of loaded IPs from Cloudflare., (*2)
If you want automatic refreshing of Cloudflare IP ranges you can schedule cloudflare:reload
command in your app. To do this open app/Console/Kernel.php
and modify schedule
function like this:, (*3)
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('cloudflare:reload') ->daily(); }
Laravel framework Service Provider to automatic loading IP ranges of Cloudflare trust proxies.
MIT
laravel framework proxy cloudflare proxies trust