Trust Cloudflare's Proxies for Laravel
Add Cloudflare ip addresses to trusted proxies for Laravel.
Install using composer:
composer require monicahq/laravel-cloudflare
You don't need to add this package to your service providers.
Add the middleware in
app/Http/Kernel.php, adding a new line in the
This package supports Laravel 5.6 or newer.
Refreshing the Cache
This package basically retrieves Cloudflare's IP blocks, and stores in cache.
When request comes, loads Cloudflare's IP blocks to trusted proxies.
That's why, you'll need to every day refresh the cache.
You can use the following command for this.
php artisan cloudflare:reload
Suggestion: add the command in the schedule.
Add a new line in
app/Console/Kernel.php, in the
View current Cloudflare's IP blocks
You can use the following command to see the cached IP blocks.
php artisan cloudflare:view
This repository licensed under the MIT license.