Reputation: 11508
I'm using Laravel 4.2 and I'm using a Flexible SSL from Cloudflare.
I have this code on filters.php
for example:
App::before(function($request)
{
if (Request::secure())
return 'False';
});
and when I try to run this on my secured server, I get the False
Response.
Did I do something wrong here?
Upvotes: 1
Views: 2697
Reputation: 39429
Did I do something wrong here?
Yes. You’re returning a string rather than a boolean. Try this instead:
App::before(function($request)
{
if (Request::secure())
return false;
});
I’m not sure what you’re trying to achieve, though? If you want to enforce access via SSL, then redirect to the HTTPS version. Returning false
will just give the user a blank page.
Upvotes: 0
Reputation: 11508
The reason the secure()
function returns false is because the site doesn't really have an SSL Certificate, CloudFlare has. so when the clients connect to the site, the actually connect to CloudFlare (SSL) and CloudFlare connects to the site (Not SSL). So in conclusion, the Request between CloudFlare and the Site is not secured.
Upvotes: 1