Last active
November 3, 2017 08:53
-
-
Save peppeocchi/4f522663d7e88029daeba833c835df3d to your computer and use it in GitHub Desktop.
Laravel middleware for Elastic Beanstalk (HTTPS and Load balancer)
This file contains 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 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