Web Hosting Knowledge Base Web Hosting Knowledge Base
  • Home
Get Started
Web Hosting Knowledge Base Web Hosting Knowledge Base
Get Started
Web Hosting Knowledge Base Web Hosting Knowledge Base
  • Home
loading
  1. Home
  2. Security
  3. How to fix mixing of secure and insecure content on a web page
Updated on June 22, 2024

Security

  • Folder icon closed Folder open iconWhat is KernelCare?
  • Folder icon closed Folder open iconHow to help prevent spam in cPanel
  • Folder icon closed Folder open iconHow To Prevent Outgoing Email From Being Marked As Spam
  • Folder icon closed Folder open iconHow To Secure Your WordPress Site
  • Folder icon closed Folder open iconAn introduction to SSL
  • Folder icon closed Folder open iconHow to install a third-party SSL certificate
  • Folder icon closed Folder open iconHow to install an Organization Verified SSL certificate
  • Folder icon closed Folder open iconHow to install a Domain Verified SSL certificate
  • Folder icon closed Folder open iconHow to renew an SSL certificate
  • Folder icon closed Folder open iconHow to redirect visitors to SSL connections
  • Folder icon closed Folder open iconHow to use www and non-www domains with an SSL certificate
  • Folder icon closed Folder open iconHow To Find SSL Certificate Fingerprints
  • Folder icon closed Folder open iconHow to generate a private key and CSR from the command line
  • Folder icon closed Folder open iconHow to fix mixing of secure and insecure content on a web page
  • Folder icon closed Folder open iconHow to install an SSL certificate site seal
  • Folder icon closed Folder open iconSSL certificates and Server Name Indication (SNI) support
  • Folder icon closed Folder open iconHow to determine the OpenSSL version
  • Folder icon closed Folder open iconHow to secure an unmanaged server with a Let's Encrypt SSL certificate
  • Folder icon closed Folder open iconDifferences between Let's Encrypt certificates and traditional CA-issued certificates
  • Folder icon closed Folder open iconHow to manage HTTP Strict Transport Security (HSTS) for your site
  • Folder icon closed Folder open iconHow to install a self-signed SSL certificate
  • Folder icon closed Folder open iconDifferences between a cPanel certificate and a traditional CA-issued certificate
  • Folder icon closed Folder open iconWhere are SSL certificates from DigiCert, Sectigo, and cPanel banned?
  • Folder icon closed Folder open iconWhere are Comodo SSL certificates banned?
  • Folder icon closed Folder open iconPerpetual Security information
  • Folder icon closed Folder open iconHow to secure an unmanaged server
  • Folder icon closed Folder open iconHow to repair and secure a hacked site
  • Folder icon closed Folder open iconHow to help prevent spam
  • Folder icon closed Folder open iconHow to create a strong password
  • Folder icon closed Folder open iconHow to install server updates
  • Folder icon closed Folder open iconHow to harden a server with fail2ban
  • Folder icon closed Folder open iconHow to fix the Heartbleed vulnerability on unmanaged servers
  • Folder icon closed Folder open iconUnderstanding software vulnerabilities and protecting your account
  • Folder icon closed Folder open iconHow to protect yourself from email phishing scam attempts
  • Folder icon closed Folder open iconHow to generate Google reCAPTCHA keys for site security
  • Folder icon closed Folder open iconTLS and cipher suites update for December 2019
  • Folder icon closed Folder open iconHow to request Google to review hacked sites and remove Deceptive Site Ahead’ warning
  • Folder icon closed Folder open iconWhat is email spoofing?
  • Folder icon closed Folder open iconMigrations and legacy e-mail client applications
  • Folder icon closed Folder open iconSecure Sockets Layer (SSL) information
    • SSL/TLS certificate validity periods
    • How to generate a purchased SSL certificate for an unmanaged hosting account

How to fix mixing of secure and insecure content on a web page

Estimated reading: 3 minutes 214 views

This article describes an issue that occurs when visitors to your web site request a secure web page that contains insecure elements.Table of Contents

  • Problem
  • Cause
  • Resolution
  • Method #1: Send a Content-Security-Policy response header directly from the web server
  • Method #2: Send a Content-Security-Policy directive from page source files
  • More Information

Problem

When visitors to your web site request a page using a secure https:// connection, a broken padlock icon may appear in the web browser’s location bar. Additionally, they may receive a warning message in their browser:

  • Mozilla Firefox displays:
    “The connection to this website is not fully secure because it contains unencrypted elements (such as images).”
  • Microsoft Internet Explorer displays:
    “Do you want to view only the webpage content that was delivered securely?
    This webpage contains content that will not be delivered using a secure HTTPS connection, which could compromise the security of the entire webpage.”
  • Google Chrome displays:
    “Your connection to example.com is encrypted with 256-bit encryption. However, this page includes other resources which are not secure. These resources can be viewed by others while in transit, and can be modified by an attacker to change the look of the page.”

Cause

This problem occurs because a web page contains hyperlinks to insecure elements. For example, consider a web page that contains the following HTML snippet:

<a href="http://www.example.com/images/picture.jpg">View my picture</a>

In this HTML snippet, the hyperlink references a non-secure http:// resource (a .jpg file). If a user requests this page using an https:// connection, the page itself is encrypted, but the hyperlinked image file is not. As a result, the page contains secure and insecure content, and the browser displays a warning message to the user.

This problem can occur with any type of hyperlinked resource file: a JavaScript library, a CSS file, etc.

Resolution

There are a few ways you can resolve this problem:

Method #1: Send a Content-Security-Policy response header directly from the web server

To resolve this problem, you can send a Content-Security-Policy HTTP response header. This header instructs web browsers to upgrade insecure requests to HTTPS.

For Apache web servers on Linux, add the following lines to the .htaccess file (or files) that you use on your website:

<IfModule mod_headers.c>
    Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
Method #2: Send a Content-Security-Policy directive from page source files

Alternatively, you can use the following meta tag in the source files of your site pages:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

More Information

For more information about the upgrade-insecure-requests directive, please visit https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests.

How to publish your web site with PageBreeze

Still stuck? How can we help?

How can we help?

Was this page helpful? Yes No

Share this Doc

How to fix mixing of secure and insecure content on a web page

Or copy link

Clipboard Icon
CONTENTS
Leaf Illustration

© 2023 All Rights Reserved by Hostvento