Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome loading script over http on https page

We have absolute paths in template, i.e.:

<link rel="stylesheet" href="/media/css/ui.css?v=3" />

When I'm trying to open https page - I get following error:

[blocked] The page at 'https://{{ full_site }}/{{secure_page}}' was loaded over HTTPS, 
but ran insecure content from 'http://{{full_site }}/media/css/ui.css?v=3': 
this content should also be loaded over HTTPS.

But path https://{{full_site }}/media/css/ui.css?v=3 is available...

Tell me, why chrome trying to load content over http on https page? And how to force it to load scripts over https on relative paths?

UPD Page loads perfectly in firefox. So this is only chrome issue. All paths are relative.

like image 606
Nikolay Fominyh Avatar asked Oct 03 '22 02:10

Nikolay Fominyh


1 Answers

This could be the reason that your CSS file ui.css may be referring to resources (e.g. images) via background or background-image property which is loading insecure content (Content from HTTP servers)

If you have resources on your site, use Relative Protocol Links like

url(//example.com/images/some_image.png)

Similarly, update your link to use relative protocol link like

<link rel="stylesheet" href="//{{full site}}/media/css/ui.css?v=3" />
like image 62
Sachin Avatar answered Oct 09 '22 17:10

Sachin