tkaratug/laravel-domain-whitelist
Composer 安装命令:
composer require tkaratug/laravel-domain-whitelist
包简介
A domain wwhitelist checker middleware.
README 文档
README
Introduction
This package contains a middleware to check whether the origin domain is in the whitelist. If not it blocks the request.
Installation
You can install the package via composer:
composer require tkaratug/laravel-domain-whitelist
You can publish the config file with:
php artisan vendor:publish --provider="Tkaratug\LaravelDomainWhitelist\LaravelDomainWhitelistServiceProvider" --tag="domain-whitelist-config"
This is the contents of the published config file:
return [ /* |--------------------------------------------- | Domains to allow | Leave empty to allow all requests |--------------------------------------------- */ 'domains' => [ //'*.example.com', //'example.com', ], /* |--------------------------------------------- | Paths to exclude |--------------------------------------------- */ 'excludes' => [ //'/api/posts', ], ];
Usage
Packages comes with DomainWhitelist middleware. You can register it in $routeMiddleware in app/Http/Kernel.php file:
protected $routeMiddleware = [ // ... 'domain_whitelist' => \Tkaratug\LaravelDomainWhitelist\Middlewares\DomainWhitelist::class, ];
Use the middleware in any of your routes.
Route::middleware('domain_whitelist')->get('/', [HomeController::class, 'index']);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-20