خطا هنگام اجرای php artisan serve

4 هفته پیش
توسط coarad supp آپدیت شد
Saied Hr ( 12860 تجربه )
4 هفته پیش

سلام دوستان من هنگام اجرای دستور Php artisan serve با این مشکل مواجه میشم.لطفا راهنمایی کنید.

[*** Feb  1 14:50:57 2020] 127.0.0.1:2126 Invalid request (Unsupported SSL request)
coarad supp ( 7550 تجربه )
4 هفته پیش

I solved this later, just in case anyone has a similar problem in the future, I discovered the AppServiceProvider class had a register method where a security interception middleware was registered to force every http request to https. so what I did was write an if-else logic to allow this only on production since my localhost had no ssl certificate.

in app/providers/AppServiceProvider.php

look for the register() method, the implement the logic by checking tha app is local or not. The isLocal() function checks your .env file for APP_ENV variable and returns true if is local, so you reconfirm again that that is set to local and be sure to clear any previous configuration cache.

            //check that app is local
       if ($this->app->isLocal()) {
              //if local register your services you require for development
            $this->app->register('Barryvdh\Debugbar\ServiceProvider');
        }else{
              //else register your services you require for production
            $this->app['request']->server->set('HTTPS', true);
        }

https://stackoverflow.com/questions/57617864/how-to-fix-invalid-request-unsupported-ssl-request

برای ارسال پاسخ باید وارد سایت شوید