laravel-embargoed maintained by pretzelhands
Description
Middleware to block all requests from Russia to any Laravel app and display a pro-Ukraine message instead
Author
Last update
2022/02/26 19:56
(dev-master)
License
Downloads
1
What does this middleware do?
This middleware checks the IP of visitors coming to your site for their origin. If it detects a Russian IP, instead of continuing as normal it will block the visit and display a pro-Ukrainian message.
The message looks as follows:

Installation
- Install the package via composer:
composer require pretzelhands/laravel-embargoed - Add the
Pretzelhands\Embargoed\Http\Middleware\EmbargoOnRussiamiddleware to yourapp/Http/Kernel.php
<?php
// .. SNIP ..
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\Pretzelhands\Embargoed\Http\Middleware\EmbargoOnRussia::class // Middleware added!
];
// .. SNIP ..
The middleware will be active from then on and block all visits from Russia.
Other technologies
This middleware is supported in a variety of different technology stacks. You can find an exhaustive list in this repository
Collaborate
Please feel free to contact me, @pretzelhds or fork this to port it to other platforms, or make PRs to this repo to collaborate.