Created
February 5, 2019 19:11
-
-
Save jhowbhz/06f6a78273aff533a970697676f41800 to your computer and use it in GitHub Desktop.
ssl-middleware
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
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