Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel middleware for Elastic Beanstalk (HTTPS and Load balancer)
<?php namespace App\Http\Middleware;
use Closure;
/**
* Put this file in app/Http/Middleware
* Read more here https://github.com/peppeocchi/laravel-elb-middleware
*
*/
class ElasticBeanstalkHttps
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$request->setTrustedProxies(['127.0.0.1', $request->server->get('REMOTE_ADDR')]);
return $next($request);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment