Last active
February 28, 2017 02:38
-
-
Save stevesbrain/1cb35efc65e35e5b04ee95bc1acbae2a to your computer and use it in GitHub Desktop.
Laravel 5.1.40 (LTS) HTTPS Load Balancer ValidProxies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
protected $middleware = [ | |
// ... | |
\FI\Http\Middleware\ValidProxies::class, | |
]; | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace FI\Http\Middleware; | |
use Closure; | |
class ValidProxies { | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
// Proxies | |
$request->setTrustedProxies([ $request->getClientIp() ]); | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had some troubles with the original version - possibly meant for older or newer Laravel. This is tested with HAProxy + FusionInvoice.