All Projects → monicahq → Laravel Cloudflare

monicahq / Laravel Cloudflare

Licence: mit
Add Cloudflare ip addresses to trusted proxies for Laravel.

Projects that are alternatives of or similar to Laravel Cloudflare

Request.js
Send parameterized requests to GitHub’s APIs with sensible defaults in browsers and Node
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Rakudo
🦋 Rakudo – Raku on MoarVM, JVM, and JS
Stars: ✭ 1,471 (+1300.95%)
Mutual labels:  hacktoberfest
Powershell
Development repository for the powershell cookbook
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Wingpanel
Stylish top panel that holds indicators and spawns an application launcher
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Operating System
🔰 Home Assistant Operating System
Stars: ✭ 1,920 (+1728.57%)
Mutual labels:  hacktoberfest
Bonjourbrowser
Service Browser is a utility that discovers all services registered in a network
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Community.vmware
Ansible Collection for VMWare
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Zfs Localpv
CSI Driver for dynamic provisioning of Persistent Local Volumes for Kubernetes using ZFS.
Stars: ✭ 105 (+0%)
Mutual labels:  hacktoberfest
Markor
Text editor - Notes & ToDo (for Android) - Markdown, todo.txt, plaintext, math, ..
Stars: ✭ 1,394 (+1227.62%)
Mutual labels:  hacktoberfest
Vagrant Librarian Puppet
A Vagrant plugin to install Puppet modules using Librarian-Puppet.
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Ts React Boilerplate
Universal React App with Redux 4, Typescript 3, and Webpack 4
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Serenity
A Rust library for the Discord API.
Stars: ✭ 1,387 (+1220.95%)
Mutual labels:  hacktoberfest
Larasupport
📦 Adds Laravel Packages Support to Lumen and Vendor Publish Artisan Command.
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Hacktoberfest Census
A census of those participating in Hacktoberfest (and an easy PR!)
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Famous Bugs
Famous bugs fixed, problems solved and failures experienced in software history 🐛 🐝 🐜 🐞
Stars: ✭ 105 (+0%)
Mutual labels:  hacktoberfest
React Native Draftjs
A full fledged React Native Rich Text editor based on draft.js
Stars: ✭ 103 (-1.9%)
Mutual labels:  hacktoberfest
Paraunit
Run PHPUnit tests in parallel
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Ant Design Draggable Modal
The Modal from Ant Design, draggable.
Stars: ✭ 105 (+0%)
Mutual labels:  hacktoberfest
Markscribe
Your personal markdown scribe with template-engine and Git(Hub) & RSS powers 📜
Stars: ✭ 105 (+0%)
Mutual labels:  hacktoberfest
Libmtev
Mount Everest Application Framework
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest

Trust Cloudflare's Proxies for Laravel

Add Cloudflare ip addresses to trusted proxies for Laravel.

Latest Version Downloads GitHub Workflow Status Sonar Quality Gate Coverage Status

Installation

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 middleware array:

\Monicahq\Cloudflare\Http\Middleware\TrustProxies::class

Existing Laravel application

This middleware uses fideloper/proxy as a backend, so you can remove the other TrustProxies line from the middleware array.

Another option is to extend the App\Http\Middleware\TrustProxies class to Monicahq\Cloudflare\Http\Middleware\TrustProxies:

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Monicahq\Cloudflare\Http\Middleware\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    ...

If the cloudflare ips are detected, they will be used, and if not the trustproxies one will be.

Refreshing the Cache

This package basically retrieves Cloudflare's IP blocks, and stores them in cache. When request comes, the middleware will get Cloudflare's IP blocks from cache, and load them to trusted proxies.

Thus, you'll need to refresh the cloudflare cache every day

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 schedule function:

$schedule->command('cloudflare:reload')->daily();

View current Cloudflare's IP blocks

You can use the following command to see the cached IP blocks.

php artisan cloudflare:view

Option: publish the package config file

If you want, you can publish the package config file to config/laravelcloudflare.php:

php artisan vendor:publish --provider="Monicahq\Cloudflare\TrustedProxyServiceProvider"

This file contains some configurations, but you may not need to change them normally.

Support

This package supports Laravel 5.5 or newer.

Citations

This package was inspired by lukasz-adamski/laravel-cloudflare and forked from ogunkarakus/laravel-cloudflare.

License

Author: Alexis Saettler

This project is part of MonicaHQ.

Copyright (c) 2019-2020.

Licensed under the MIT License. View license.

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].