ldc-doux/app/Providers/AppServiceProvider.php

28 lines
615 B
PHP
Raw Permalink Normal View History

2021-11-18 14:36:06 +01:00
<?php
namespace App\Providers;
2022-02-04 18:35:33 +01:00
use Illuminate\Support\Facades\URL;
2021-11-18 14:36:06 +01:00
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
2022-05-10 09:36:01 +02:00
URL::forceScheme('https');
2023-06-26 08:52:32 +00:00
// * HA PROXY FIX
app()->singleton('clientIp', function () {
if (config('app.env') === 'local') {
return request()->getClientIp();
}
return request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp();
});
2021-11-18 14:36:06 +01:00
}
}