简体   繁体   中英

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. 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:

"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.

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. The problem is that Safari isn't able to recover from this issue at all only by clearing browsing cache and cookies.

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.

Thanks, Andre

To be honest. Since where dealing with laravel I will not recommend to go with https forced on the .htaccess file. simply create a middleware that will check if the user is not on https and redirect him. It'll work better on laravel 5.1 and I also think that the problem will solve.

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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