Photo by Sebastian Herrmann on Unsplash

Problem :

Have you ever faced the following issue in a Laravel project that runs perfectly fine on your local environment, butafter deploying your project to a server gives you problem? Do not worry, I have the solution

Mixed Content: The page at ‘https://www.example.com/index.php?main_page=login' was loaded over HTTPS, but requested an insecure stylesheet ‘http://www.example.com/ex2.html'. This request has been blocked; the content must be served over HTTPS.

Solution:

In app → Provider → AppSericeProvider.php, you will have to add :

use Illuminate\Support\Facades\URL; — — — in the top

if(env(‘APP_ENV’) == ‘production’){
URL::forceScheme(‘https’);
} — — — in the ‘bool’ function’, when running this locally you would want it to be commented just in case unless you change the APP_ENV …

--

--