Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'insecure mixed content' error #116

Open
yamgent opened this issue Apr 3, 2019 · 0 comments
Open

Fix 'insecure mixed content' error #116

yamgent opened this issue Apr 3, 2019 · 0 comments

Comments

@yamgent
Copy link
Member

yamgent commented Apr 3, 2019

I am getting complaints from Netlify that the learningresources website is serving insecure mixed content.

Background (insecure mixed content)

HTTP serves content through an un-encrypted channel, which means anyone can intercept the content and modify it without anyone knowing. That is why websites are recommended to activate HTTPS (which our website does), to send them through an encrypted channel.

However, even if the webpage is served in HTTPS, if the webpage embeds other resources using HTTP, then the embedded resources themselves can be compromised, even if the main webpage cannot be tampered with. Hence, this is 'insecure mixed content'.

Problem

Netlify found several images that are served through http rather than https (see the Netlify log for the list of insecure images).

Solution

  1. Force browsers to always access content via the https protocol by using a meta tag. That way, regardless of whatever protocol the page authors specified for their resource's reference uri, it will always be served through https protocol.

    This can be done by putting the following in _markbind/head/head.md:

    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  2. Some http content just don't have https equivalent, so forcing https will cause them to be broken. So, we either have to (1) save these images onto our repository and serve it ourselves, (2) find alternative subsitutes, or (3) not use them.

    The list of images that needs checking and fixing can be found in the Netlify logs.

    Note: Be sure to put proper attribution if you do (1)!


For more info: https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant