简体   繁体   English

Laravel SSL协议错误

[英]Laravel SSL Protocol Error

I've purchased a test SSL certificate while my client acquires the EV one and I've set it up with a Laravel 5.1 project. 我购买了一个测试SSL证书,而我的客户则购买了一个EV证书,并使用Laravel 5.1项目对其进行了设置。 I've forced the site to use https:// all the time using .htaccess but once in a while the entire site breaks and becomes unusable after this error: 我强迫网站始终使用.htaccess使用https:// ,但有时会因以下错误而使整个网站崩溃并无法使用:

"The operation couldn't be completed. Protocol Error." NSPOSIXErrorDomain:100

Other people are getting this issue with Laravel projects, however I haven't been able to find a stable solution. 其他人在Laravel项目中遇到了这个问题,但是我一直找不到稳定的解决方案。

https://www.litespeedtech.com/support/forum/threads/solved-ls-5-0-stable-protocol-error-with-ssl-sites.11459/ https://www.litespeedtech.com/support/forum/threads/solved-ls-5-0-stable-protocol-error-with-ssl-sites.11459/

This error only happens in Safari under iOS and OSX. 仅在iOS和OSX下的Safari中会发生此错误。 The problem is that Safari isn't able to recover from this issue at all only by clearing browsing cache and cookies. 问题在于,仅通过清除浏览缓存和cookie,Safari根本无法从此问题中恢复。

I'd need help with this because I lose every single visitor on the site after a few minutes who uses Safari on iOS or OSX. 我需要这方面的帮助,因为几分钟后,我失去了网站上的所有访客,他们在iOS或OSX上使用Safari。

Thanks, Andre 谢谢,安德烈

To be honest. 老实说。 Since where dealing with laravel I will not recommend to go with https forced on the .htaccess file. 由于在这里处理laravel,所以我不建议在.htaccess文件中使用https强制。 simply create a middleware that will check if the user is not on https and redirect him. 只需创建一个中间件即可检查用户是否不在https上并将其重定向。 It'll work better on laravel 5.1 and I also think that the problem will solve. 它将在laravel 5.1上更好地工作,我也认为该问题将会解决。

Middleware example: 中间件示例:

class HttpsProtocol
{

    public function handle($request, Closure $next)
    {
        if (!$request->secure()) {
            return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
}

Hope it helps. 希望能帮助到你。 It worked great for me :) Good luck... 这对我来说很棒:)祝你好运...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM