From e6fe522f6d431c3b01c81d42e0d969d78f335a2e Mon Sep 17 00:00:00 2001 From: shibafu Date: Sat, 2 Mar 2019 11:06:08 +0900 Subject: [PATCH] =?UTF-8?q?laravel/laravel:5.5=E3=81=8B=E3=82=89TrustProxi?= =?UTF-8?q?es=E3=82=92=E8=BC=B8=E5=85=A5=20(#120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Kernel.php | 1 + app/Http/Middleware/TrustProxies.php | 29 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 app/Http/Middleware/TrustProxies.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 66d34c3..93bf68b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -18,6 +18,7 @@ class Kernel extends HttpKernel \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + \App\Http\Middleware\TrustProxies::class, ]; /** diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php new file mode 100644 index 0000000..39d1770 --- /dev/null +++ b/app/Http/Middleware/TrustProxies.php @@ -0,0 +1,29 @@ + 'FORWARDED', + Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', + Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', + Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', + Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', + ]; +}