Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
sexelleryoga/app/Http/Middleware/TrustedProxiesMiddleware.php

29 lines
No EOL
714 B
PHP

<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
class TrustedProxiesMiddleware
{
/**
* use 0.0.0.0/0 if you trust any proxy, otherwise replace it with your proxy ips
*
* @var string[]
*/
protected $trustedProxies = [
'0.0.0.0/0'
];
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
public function handle(Request $request, \Closure $next){
Request::setTrustedProxies($this->trustedProxies, $this->headers);
return $next($request);
}
}