Laravel asks for HTTP if HTTPS is activated
So I have a problem where on most pages we need a user to be on SSL. Thus, we have the following code with a route to force the user to switch to SSL mode.
//secure app route
Route::filter('force.ssl', function()
{
if( ! Request::secure())
{
return Redirect::secure(Request::path());
}
});
This works great, however, on two specific pages, the user must be in http mode (problem with external server not accepting https requests). How can you apply this same logic in reverse order? I'm guessing something like this, but is the redirection insecure?
//secure app route
Route::filter('force.nossl', function()
{
if(Request::secure())
{
return Redirect::unsecure(Request::path());
}
});
+1
source to share