shakeelabbas's avatar

Laravel Breeze cant support HTTPS

I have a simple laravel 8 application using Laravel Breeze for auth. However in production it cant support https connections, with a warning saying it 'was not allowed to run insecure content from app.css and app.js'.

I haven't changed any settings and am using the default design (no issues on localhost)

0 likes
3 replies
shakeelabbas's avatar

Hmm, nothing there seems to be working. For some reason its still rejecting css and js files. Tried setting app url to both http and https version of the production url, but the issue is still persisting.

jlrdw's avatar
jlrdw
Best Answer
Level 75

Edited:

I was curious and did a specific search, are you using the asset hepler, I assumed you were, see this: https://stackoverflow.com/questions/48594587/css-and-js-not-working-over-https-in-laravel

Still see other below if needed.

In the app\Providers folder, open AppServiceProvider.php and add in boot method:

if($this->app->environment('production')) {
    \URL::forceScheme('https');
}

Then run

php artisan config:clear

Should work, cache again if needed.

Also in RouteServiceProvider.php you can try:

    public function boot()
    {
        resolve(\Illuminate\Routing\UrlGenerator::class)->forceScheme('https');

        parent::boot();
    }

Followed by a

php artisan route:clear

Another technique I have seen used is in env file:

FORCE_HTTPS=true

If you have any hard coded http, you have to manually change to https. Remember to run the various clear commands as needed when making changes.

2 likes

Please or to participate in this conversation.