Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Created February 5, 2019 19:11
Show Gist options
  • Save jhowbhz/06f6a78273aff533a970697676f41800 to your computer and use it in GitHub Desktop.
Save jhowbhz/06f6a78273aff533a970697676f41800 to your computer and use it in GitHub Desktop.
ssl-middleware
namespace MyApp\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\App;
class HttpsProtocol {
public function handle($request, Closure $next)
{
if (!$request->secure() && App::environment() === 'production') {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment