Grigio Grigio - 1 year ago 122
HTTP Question

Load Blade assets with https in Laravel

I am loading my css using this format:

<link href="{{ asset('assets/mdi/css/materialdesignicons.min.css') }}" media="all" rel="stylesheet" type="text/css" />

and it loads fine for all http requests

But when I load my login page with SSL (https), I get a
...page... was loaded over HTTPS, but requested an insecure stylesheet 'http...


Can someone please tell me how do I make blade load assets over https instead of http?

Should I be trying to load the assets securely? Or is it not Blade's job?

Answer Source

I believe secure_asset is what you're looking for.

<link href="{{ secure_asset('assets/mdi/css/materialdesignicons.min.css') }}" media="all" rel="stylesheet" type="text/css" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download