Skip to content

Instantly share code, notes, and snippets.

@stevesbrain
Last active February 28, 2017 02:38
Show Gist options
  • Save stevesbrain/1cb35efc65e35e5b04ee95bc1acbae2a to your computer and use it in GitHub Desktop.
Save stevesbrain/1cb35efc65e35e5b04ee95bc1acbae2a to your computer and use it in GitHub Desktop.
Laravel 5.1.40 (LTS) HTTPS Load Balancer ValidProxies
<?php
// ...
protected $middleware = [
// ...
\FI\Http\Middleware\ValidProxies::class,
];
// ...
<?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);
}
}
@stevesbrain
Copy link
Author

Had some troubles with the original version - possibly meant for older or newer Laravel. This is tested with HAProxy + FusionInvoice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment