Main > Abyss > Firefox, ошибка "Blocked loading mixed active content"

Firefox, ошибка "Blocked loading mixed active content"

07.10.2015 0 comments » Views: 2,508

Mozilla Firefox

Сегодня столкнулся с небольшой проблеммой, а именно при запуске одной странички в GitHub HtmlPreview (http://htmlpreview.github.com) получил ошибку: Blocked loading mixed active content...

Полностью ошибка выглядит так:

Blocked loading mixed active content "http://code.jquery.com/jquery-latest.js"
...in.js">\x3c/script><script>HTMLPreview.replaceAssets();\x3c/script></body>').rep...

Когда полез разбираться в чем дело, все оказалось достаточно просто, а именно FF защищает нас от аттак возможных при смешивании протоколов http и https. Кто хочет подробностей, можете почитать тут Mixed Content Blocking Enabled in Firefox 23 (https://blog.mozilla.org/tanvi/2013/04/10/mixed-content-blocking-enabled-in-firefox-23/). Если в кратце, то вот выдержка на англ:

What is Mixed Content?

When a user visits a page served over HTTP, their connection is open for eavesdropping and man-in-the-middle (MITM) attacks. When a user visits a page served over HTTPS, their connection with the web server is authenticated and encrypted with SSL and hence safeguarded from eavesdroppers and MITM attacks.

However, if an HTTPS page includes HTTP content, the HTTP portion can be read or modified by attackers, even though the main page is served over HTTPS.  When an HTTPS page has HTTP content, we call that content “mixed”. The webpage that the user is visiting is only partially encrypted, since some of the content is retrieved unencrypted over HTTP.  The Mixed Content Blocker blocks certain HTTP requests on HTTPS pages.

Так что же делать? Все просто, используйте одинаковый протокол у скрипта и страницы: http+http или https+https, но не https+http. Так же можно вообще опустить протокол т.е. ссылка будет вида: //code.jquery.com/jquery-latest.js (про то, почему это работает написано в RFC 3986: "Uniform Resource Identifier (URI): Generic Syntax", Section 4.2 - http://www.ietf.org/rfc/rfc3986.txt), однако я не советую этот способ, т.к. при открытии такого html документа с диска, у него будет путь начинающийся не с http/https а с file, а соответственно этот протокол и будет использоваться для поиска скрипта, что завершится неудачей.

Author: | Rating: 4/5 | Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Allowed HTML-tags: <a>, <code>, <i>, <em>, <strong>, <b>, <u>, <strike>