fix: fix laravel cloudflare proxy (#6264)
This commit is contained in:
@@ -13,6 +13,6 @@ class TrustProxies extends Middleware
|
|||||||
*/
|
*/
|
||||||
protected function proxies()
|
protected function proxies()
|
||||||
{
|
{
|
||||||
return config('app.trust_proxies');
|
return config('app.trust_proxies') ?? $this->proxies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Validation\Rules\Password;
|
use Illuminate\Validation\Rules\Password;
|
||||||
use Monicahq\Cloudflare\LaravelCloudflare;
|
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
use Illuminate\Auth\Notifications\VerifyEmail;
|
use Illuminate\Auth\Notifications\VerifyEmail;
|
||||||
use Werk365\EtagConditionals\EtagConditionals;
|
use Werk365\EtagConditionals\EtagConditionals;
|
||||||
use Illuminate\Auth\Notifications\ResetPassword;
|
use Illuminate\Auth\Notifications\ResetPassword;
|
||||||
use Monicahq\Cloudflare\Facades\CloudflareProxies;
|
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -114,10 +112,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
return sha1($url);
|
return sha1($url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
LaravelCloudflare::getProxiesUsing(function (): array {
|
|
||||||
return config('app.cloudflare') ? CloudflareProxies::load() : [];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Generated
+11
-11
@@ -218,16 +218,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aws/aws-sdk-php",
|
"name": "aws/aws-sdk-php",
|
||||||
"version": "3.233.0",
|
"version": "3.233.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||||
"reference": "2aabbc276b61515ae1897f037fc34ad56028d744"
|
"reference": "1eeac24f921f146b7cef5beb61375d7852df7cf8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2aabbc276b61515ae1897f037fc34ad56028d744",
|
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1eeac24f921f146b7cef5beb61375d7852df7cf8",
|
||||||
"reference": "2aabbc276b61515ae1897f037fc34ad56028d744",
|
"reference": "1eeac24f921f146b7cef5beb61375d7852df7cf8",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -304,9 +304,9 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.233.0"
|
"source": "https://github.com/aws/aws-sdk-php/tree/3.233.1"
|
||||||
},
|
},
|
||||||
"time": "2022-08-11T18:15:54+00:00"
|
"time": "2022-08-12T18:18:34+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@@ -4708,16 +4708,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "monicahq/laravel-cloudflare",
|
"name": "monicahq/laravel-cloudflare",
|
||||||
"version": "3.2.2",
|
"version": "3.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/monicahq/laravel-cloudflare.git",
|
"url": "https://github.com/monicahq/laravel-cloudflare.git",
|
||||||
"reference": "bc8881e04223bdd1c564fdfcdc09f11c443e917d"
|
"reference": "80318641a7a85bf29e6c24cf850309bb12df1486"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/monicahq/laravel-cloudflare/zipball/bc8881e04223bdd1c564fdfcdc09f11c443e917d",
|
"url": "https://api.github.com/repos/monicahq/laravel-cloudflare/zipball/80318641a7a85bf29e6c24cf850309bb12df1486",
|
||||||
"reference": "bc8881e04223bdd1c564fdfcdc09f11c443e917d",
|
"reference": "80318641a7a85bf29e6c24cf850309bb12df1486",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -4780,7 +4780,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-01-30T15:22:48+00:00"
|
"time": "2022-08-13T21:35:05+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "monicahq/laravel-sabre",
|
"name": "monicahq/laravel-sabre",
|
||||||
|
|||||||
@@ -151,16 +151,6 @@ return [
|
|||||||
|
|
||||||
'trust_proxies' => env('APP_TRUSTED_PROXIES', env('APP_TRUST_PROXIES')),
|
'trust_proxies' => env('APP_TRUSTED_PROXIES', env('APP_TRUST_PROXIES')),
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Enable cloudflare trusted proxies
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Enable to trust cloudflare proxies.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
'cloudflare' => (bool) env('APP_TRUSTED_CLOUDFLARE', false),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Autoloaded Service Providers
|
| Autoloaded Service Providers
|
||||||
|
|||||||
@@ -1,170 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Debugbar Settings
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Debugbar is enabled by default, when debug is set to true in app.php.
|
|
||||||
| You can override the value by setting enable to true or false instead of null.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'enabled' => null,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Storage settings
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| DebugBar stores data for session/ajax requests.
|
|
||||||
| You can disable this, so the debugbar stores data in headers/session,
|
|
||||||
| but this can cause problems with large data collectors.
|
|
||||||
| By default, file storage (in the storage folder) is used. Redis and PDO
|
|
||||||
| can also be used. For PDO, run the package migrations first.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
'storage' => [
|
|
||||||
'enabled' => true,
|
|
||||||
'driver' => 'file', // redis, file, pdo, custom
|
|
||||||
'path' => storage_path('debugbar'), // For file driver
|
|
||||||
'connection' => null, // Leave null for default connection (Redis/PDO)
|
|
||||||
'provider' => '', // Instance of StorageInterface for custom driver
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Vendors
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Vendor files are included by default, but can be set to false.
|
|
||||||
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
|
|
||||||
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
|
|
||||||
| and for js: jquery and and highlight.js
|
|
||||||
| So if you want syntax highlighting, set it to true.
|
|
||||||
| jQuery is set to not conflict with existing jQuery scripts.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'include_vendors' => true,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Capture Ajax Requests
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
|
|
||||||
| you can use this option to disable sending the data through the headers.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'capture_ajax' => true,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Clockwork integration
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
|
|
||||||
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
'clockwork' => false,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| DataCollectors
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Enable/disable DataCollectors
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'collectors' => [
|
|
||||||
'phpinfo' => true, // Php version
|
|
||||||
'messages' => true, // Messages
|
|
||||||
'time' => true, // Time Datalogger
|
|
||||||
'memory' => true, // Memory usage
|
|
||||||
'exceptions' => true, // Exception displayer
|
|
||||||
'log' => false, // Logs from Monolog (merged in messages if enabled)
|
|
||||||
'db' => true, // Show database (PDO) queries and bindings
|
|
||||||
'views' => true, // Views with their data
|
|
||||||
'route' => true, // Current route information
|
|
||||||
'laravel' => false, // Laravel version and environment
|
|
||||||
'events' => false, // All events fired
|
|
||||||
'default_request' => false, // Regular or special Symfony request logger
|
|
||||||
'symfony_request' => true, // Only one can be enabled..
|
|
||||||
'mail' => true, // Catch mail messages
|
|
||||||
'logs' => false, // Add the latest log messages
|
|
||||||
'files' => false, // Show the included files
|
|
||||||
'config' => false, // Display config settings
|
|
||||||
'auth' => false, // Display Laravel authentication status
|
|
||||||
'gate' => false, // Display Laravel Gate checks
|
|
||||||
'session' => true, // Display session data
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Extra options
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Configure some DataCollectors
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'options' => [
|
|
||||||
'auth' => [
|
|
||||||
'show_name' => false, // Also show the users name/email in the debugbar
|
|
||||||
],
|
|
||||||
'db' => [
|
|
||||||
'with_params' => true, // Render SQL with the parameters substituted
|
|
||||||
'timeline' => false, // Add the queries to the timeline
|
|
||||||
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
|
|
||||||
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
|
|
||||||
'enabled' => false,
|
|
||||||
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
|
|
||||||
],
|
|
||||||
'hints' => true, // Show hints for common mistakes
|
|
||||||
],
|
|
||||||
'mail' => [
|
|
||||||
'full_log' => false,
|
|
||||||
],
|
|
||||||
'views' => [
|
|
||||||
'data' => false, //Note: Can slow down the application, because the data can be quite large..
|
|
||||||
],
|
|
||||||
'route' => [
|
|
||||||
'label' => true, // show complete route on bar
|
|
||||||
],
|
|
||||||
'logs' => [
|
|
||||||
'file' => null,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Inject Debugbar in Response
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Usually, the debugbar is added just before </body>, by listening to the
|
|
||||||
| Response after the App is done. If you disable this, you have to add them
|
|
||||||
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'inject' => true,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| DebugBar route prefix
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Sometimes you want to set route prefix to be used by DebugBar to load
|
|
||||||
| its resources from. Usually the need comes from misconfigured web server or
|
|
||||||
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
'route_prefix' => '_debugbar',
|
|
||||||
|
|
||||||
];
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enable or disable the middleware proxy and the reload
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you set it to false, the middleware and the reload command will never
|
||||||
|
| be executed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'enabled' => (bool) env('LARAVEL_CLOUDFLARE_ENABLED', env('APP_TRUSTED_CLOUDFLARE', false)),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Name of the cache to store values of the proxies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value is the key used in the cache (table, redis, etc.) to store the
|
||||||
|
| values.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cache' => 'cloudflare.proxies',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cloudflare main url
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the url for the cloudflare api.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'url' => 'https://www.cloudflare.com',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cloudflare uri for ipv4 ips response
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the path to get the values of ipv4 ips from Cloudflare.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'ipv4-path' => 'ips-v4',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cloudflare uri for ipv6 ips response
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the path to get the values of ipv6 ips from Cloudflare.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'ipv6-path' => 'ips-v6',
|
||||||
|
|
||||||
|
];
|
||||||
@@ -72,5 +72,6 @@
|
|||||||
<env name="MAIL_PORT" value=""/>
|
<env name="MAIL_PORT" value=""/>
|
||||||
<env name="MAIL_ENCRYPTION" value=""/>
|
<env name="MAIL_ENCRYPTION" value=""/>
|
||||||
<env name="APP_EMAIL_NEW_USERS_NOTIFICATION" value=""/>
|
<env name="APP_EMAIL_NEW_USERS_NOTIFICATION" value=""/>
|
||||||
|
<env name="LARAVEL_CLOUDFLARE_ENABLED" value="false"/>
|
||||||
</php>
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
Reference in New Issue
Block a user