add docker ip
This commit is contained in:
parent
436a084581
commit
445f9dd037
|
@ -15,12 +15,21 @@ class InternalApi
|
|||
app()->configure('internal_api');
|
||||
}
|
||||
|
||||
private function isClientIPPermitted ($ip) {
|
||||
private function isClientIPPermitted($ip)
|
||||
{
|
||||
if (!app()->environment('production', 'staging')) {
|
||||
return true;
|
||||
}
|
||||
if (Str::startsWith($ip, [
|
||||
'127.0.0.', '192.168.', '10.0.',
|
||||
'127.0.0.1',
|
||||
//局域网
|
||||
'192.168.',
|
||||
//vpc
|
||||
'10.0.',
|
||||
//pod network
|
||||
'172.20.',
|
||||
//北京办公区
|
||||
'172.16.'
|
||||
])) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,26 @@
|
|||
|
||||
namespace PdInternalApi;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
|
||||
public function boot(){
|
||||
Request::setTrustedProxies([
|
||||
//pod network
|
||||
'172.20.0.0/16',
|
||||
//vpc
|
||||
'10.0.0.0/16',
|
||||
//local
|
||||
'127.0.0.1',
|
||||
//北京办公区
|
||||
'172.16.0.0/16',
|
||||
//aliyun slb
|
||||
'100.116.0.0/16',
|
||||
], Request::HEADER_X_FORWARDED_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user