本文介绍了Laravel Request :: secure()函数返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 4.2,并且正在使用Cloudflare的Flexible SSL.

I'm using Laravel 4.2 and I'm using a Flexible SSL from Cloudflare.

例如,我在filters.php上有此代码:

I have this code on filters.php for example:

App::before(function($request)
{
    if (Request::secure())
        return 'False';
});

,当我尝试在受保护的服务器上运行它时,得到False响应.我在这里做错了吗?

and when I try to run this on my secured server, I get the False Response.Did I do something wrong here?

推荐答案

secure()函数返回false的原因是因为CloudFlare拥有的站点实际上没有SSL证书.因此,当客户端连接到站点时,实际连接到CloudFlare(SSL),而CloudFlare连接到站点(不是SSL).因此,总而言之,CloudFlare和站点之间的请求是不安全的.

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.

这篇关于Laravel Request :: secure()函数返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 07:04