Laravel Mixed Content issue and broken stylesheet

Laravel Mixed Content issue and broken stylesheet

Posted on:September 3, 2020 at 10:00 AM

Hey,

If you are facing any issue related with Mixed Content of your laravel project, here could one of the possible solution that recently I faced.

In my case, the entire stylesheet was broken and I got the following errors in the console-

Mixed content: load all resources via HTTPS to improve the security of your site.

Table of Contents

Open Table of Contents

Why it happened?

I was using asset() for declaring styles and scripts. The actual reason is the asset() won’t handle https automatically. That’s why it was happening.

How did I solve it?

In my .env file, I set the following lines-


APP_URL=https://myproject.test
ASSET_URL="${APP_URL}"

Here, I mainly added ASSET_URL that actually took the APP_URL data, that is following the https.\

Hope it will work for you also.

Thanks.