How to resolve Mixed Content error in Laravel
Often when you deploy your Laravel application, you notice there is a mixed content warning saying that youwebsite.come was loaded over HTTPS but requested an insecure …
There are a few walkarounds you could use to get rid of this warning. The first thing you want to do is set your app URL in your environment to HTTPS. Also in config/app.php, set the URL fallback to HTTPS.
Then in your AppServiceProvider, replace your boot function with the following. Remember to import the UrlGenerator class.
public function boot(UrlGenerator $url){
if(env('APP_ENV') !== 'local'){
$url->forceScheme('https');
}
}
That is it. On your next deployment, your application content should be served over HTTPS.
Thanks for reading.