Resolving Mixed Content warning from external insecure server

穿精又带淫゛_ 提交于 2021-02-05 06:46:07

问题


I have a https site and need to show content from other sites that may or may not be themselves https. Predictably enough, I'm getting warning messages like this in the console...

"Mixed Content: The page at 'https://www.example.com/' (my server) was loaded over HTTPS, but requested an insecure image 'http://www.aninsecuredomain.com/image.jpg'. (not my server) This content should also be served over HTTPS."

(not to the mention the fact that I no longer see the little padlock displayed properly in most browsers who now consider my site's network insecure).

I've read through a bunch of posts on SO on this topic, but I can't seem to find a definitive answer on whether there's anything I can do when I don't own the external servers (so can't guarantee they'll have a https version). Appreciate any thoughts on whether this is possible, and if so how I could go about achieving it!


回答1:


When you need to include content from another domain in an https webpages you can:

  • Make the owner of the other domain commit to https by explaining him the security reason behind that

  • Proxy the content through your website or host it yourself (if you have right to do it)

(If you don't see the padlock anymore it's because your page is no longer secure because it include insecure elements that could have been tempered: it's not they "consider my site's network insecure", it is indeed insecure!)




回答2:


You should use the // prefix. (instead of http[s]://)

  • On an https page, the secure version wil be loaded.
  • On on a plain http page, the plain http version will be loaded.

Edit your theme replacing every occurence of http://fonts.googleapis.com/... with //fonts.googleapis.com/...



来源:https://stackoverflow.com/questions/36222544/resolving-mixed-content-warning-from-external-insecure-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!