Enforce HTTPS and encrypt all traffic (Free, Pro, and Business)

Last updated Aug 25, 2026 HTTPS on Cloudflare involves two separate connections: visitor to Cloudflare, and Cloudflare to your origin server. Both must be encrypted for end-to-end security. This guide walks through five stages:

  1. Configure your SSL/TLS encryption mode.
  2. Redirect all HTTP requests to HTTPS.
  3. Harden your HTTPS setup with minimum TLS versions and HSTS.
  4. Monitor third-party scripts on your pages.
  5. Verify your configuration.

The core workflow is available on Free, Pro, and Business plans.

Note

Most procedures in this guide are configured per domain or zone. Select your domain in the Cloudflare dashboard before starting. Client-Side Security is the exception: it is configured at the account level.

Configure your SSL/TLS encryption mode

Your SSL/TLS encryption mode controls how Cloudflare connects to your origin server. For end-to-end encryption, use Full (strict) — it encrypts both connections and verifies your origin certificate. For a detailed comparison of all available modes, refer to Encryption modes.

Check your current mode

  1. In the Cloudflare dashboard, go to the SSL/TLS Overview page. Go to Overview ↗
  2. Check the current encryption mode displayed on the page.
  3. If the mode is already Full (strict), skip to Redirect all HTTP requests to HTTPS.
  4. If the mode is not Full (strict), continue below to install an origin certificate (if needed) and change the mode.

Install a Cloudflare Origin CA certificate

If your origin server does not have a valid SSL certificate, install a free Cloudflare Origin CA certificate. Origin CA certificates are valid for up to 15 years and are trusted by Cloudflare, which means you can set your encryption mode to Full (strict) after installing one.

If your origin already has a valid certificate from a publicly trusted certificate authority, skip to Set your encryption mode to Full (strict).

1. Create an Origin CA certificate

  1. Go to the Origin Server page. Go to Origin Server ↗
  2. On the Origin Certificates tab, select Create Certificate.
  3. Choose either:
  4. Generate private key and CSR with Cloudflare: Private key type can be RSA or ECC.
  5. Use my private key and CSR: Paste your Certificate Signing Request (CSR) into the text field.
  6. List the hostnames (including wildcards) the certificate should protect with SSL encryption. The zone apex and first level wildcard hostname are included by default.
  7. Choose a Certificate Validity period.
  8. Select Create.
  9. Choose the Key Format:
  10. Servers using OpenSSL (such as Apache and NGINX) generally expect PEM files (Base64-encoded ASCII), but also work with binary DER files.
  11. Servers using Windows and Apache Tomcat require PKCS#7 (a .p7b file).
  12. Copy the signed Origin Certificate and Private Key into separate files. For security reasons, you cannot see the Private Key after you exit this screen.
  13. Select OK.

Note

For details about working with certificates programmatically, refer to API calls.

2. Install the certificate on your origin server

  1. Upload the Origin CA certificate to your origin web server.
  2. Update your web server configuration to use the certificate. For server-specific installation instructions, refer to Origin CA certificates.
  3. (Required for some servers) Upload the Cloudflare CA root certificate to your origin server.
  4. Enable SSL and port 443 at your origin web server.

Note

If you do not see your server listed, search the DigiCert documentation ↗︎ or contact your hosting provider.

Set your encryption mode to Full (strict)

After installing a valid certificate on your origin server, set the encryption mode to Full (strict) by following the steps below.

To change your encryption mode in the dashboard:

  1. In the Cloudflare dashboard, go to the SSL/TLS Overview page. Go to Overview ↗
  2. Choose an encryption mode.

To adjust your encryption mode with the API, send a PATCH request with ssl as the setting name in the URI path, and the value parameter set to your desired setting (off, flexible, full, strict, or origin_pull).

Caution

If your site shows a 526 error after changing the encryption mode, your origin certificate may not meet the requirements for Full (strict). The certificate must be unexpired, issued by a trusted CA or Cloudflare Origin CA, and contain a Common Name (CN) or Subject Alternative Name (SAN) that matches your hostname. For redirect loop issues, refer to ERR_TOO_MANY_REDIRECTS.

Redirect all HTTP requests to HTTPS

Even with an active edge certificate, visitors can still access resources over unsecured HTTP connections. Two settings work together to fix this:

  1. Always Use HTTPS redirects HTTP requests to HTTPS
  2. Automatic HTTPS Rewrites fixes mixed content references in your page HTML

Turn on Always Use HTTPS

Always Use HTTPS redirects all HTTP requests to HTTPS before they reach your origin.

Note

If only some parts of your application can support HTTPS traffic, do not turn on Always Use HTTPS. Use a single redirect to selectively redirect specific paths to HTTPS instead. Refer to Redirect admin area requests to HTTPS for an example.

  1. In the Cloudflare dashboard, go to the SSL/TLS Overview page. Go to Overview ↗
  2. Make sure that your SSL/TLS encryption mode is not set to Off. When the encryption mode is Off, the Always Use HTTPS option is not visible in the dashboard.
  3. Go to the Edge Certificates ↗︎ page.
  4. Turn on Always Use HTTPS.

  5. Make sure that your SSL/TLS encryption mode is not set to Off.

  6. Send a PATCH request with always_use_https as the setting name in the URI path, and the value parameter set to "on".

Turn on Automatic HTTPS Rewrites

Automatic HTTPS Rewrites prevents mixed content errors by rewriting HTTP resource URLs in your page HTML to HTTPS. This is useful for sites where you do not control all asset URLs, such as CMS-hosted content or embedded third-party resources.

  1. In the Cloudflare dashboard, go to the Edge Certificates page. Go to Edge Certificates ↗
  2. For Automatic HTTPS Rewrites, switch the toggle to On.

Send a PATCH request with automatic_https_rewrites as the setting name in the URI path, and the value parameter set to "on".

Note

Automatic HTTPS Rewrites does not rewrite all HTTP URLs. Some passive content (such as images) may not be rewritten, which can still cause mixed content warnings. For details on how rewrites work and troubleshooting, refer to Automatic HTTPS Rewrites and Mixed content errors.

Harden your HTTPS configuration

After your encryption mode is set and HTTP traffic is redirected, strengthen your configuration by setting a minimum TLS version, turning on HTTP Strict Transport Security (HSTS), and turning on TLS 1.3.

Set your minimum TLS version

TLS 1.0 and 1.1 have known vulnerabilities and are no longer considered secure. Setting the minimum TLS version to 1.2 blocks connections from clients using older protocols. For guidance on which version to choose, refer to TLS protocols.

  1. In the Cloudflare dashboard, go to the Edge Certificates page. Go to Edge Certificates ↗
  2. For Minimum TLS Version, select TLS 1.2.

Send a PATCH request with min_tls_version as the setting name in the URI path, and the value parameter set to "1.2".

Per-hostname minimum TLS version requires Advanced Certificate Manager

To set minimum TLS versions for individual hostnames instead of the entire zone, refer to Per-hostname setup. This requires an Advanced Certificate Manager subscription.

Turn on TLS 1.3

TLS 1.3 provides faster handshakes and improved security over TLS 1.2.

  1. In the Cloudflare dashboard, go to the Edge Certificates page. Go to Edge Certificates ↗
  2. For TLS 1.3, switch the toggle to On.

Send a PATCH request with tls_1_3 as the setting name in the URI path, and the value parameter set to "on". To also turn on 0-RTT (Zero Round Trip Time Resumption), set the value to "zrt".

Turn on HSTS

HTTP Strict Transport Security (HSTS) adds a response header that tells browsers to connect to your site over HTTPS only, even if a link or redirect tries to send them over HTTP. HSTS protects against protocol downgrade attacks.