SSL/TLS Encryption Modes, HTTPS Enforcement and Mixed Content
How edge and origin SSL/TLS work together: encryption modes, Always Use HTTPS, rewrites, HSTS, mixed content, and redirect loop fixes.
This page summarises Cloudflare SSL/TLS documentation on encrypting traffic end to end. Because Cloudflare sits between visitors and your origin, a single request can involve two certificates: an edge certificate (visitor to Cloudflare) and an origin certificate (Cloudflare to your server). Encryption modes control both legs; separate settings redirect HTTP to HTTPS and fix mixed content in HTML.
SSL/TLS certificates encrypt traffic between visitors and your website, preventing eavesdropping and data tampering. Because Cloudflare sits between your visitors and your origin server, two certificates can be involved in a single request: an edge certificate (visitor to Cloudflare) and an origin certificate (Cloudflare to your server).
— Cloudflare, Cloudflare SSL/TLS
Google’s Lighthouse and Chrome DevTools Security panel align on the same baseline: sites should load over HTTPS, avoid mixed content, and redirect plain HTTP to HTTPS.
SSL/TLS encryption mode: visitor-to-edge and edge-to-origin
Section titled “SSL/TLS encryption mode: visitor-to-edge and edge-to-origin”Your zone’s SSL/TLS encryption mode controls how Cloudflare manages two connections: one between visitors and Cloudflare, and one between Cloudflare and your origin server.
Your zone’s SSL/TLS Encryption Mode controls how Cloudflare manages two connections: one between your visitors and Cloudflare, and the other between Cloudflare and your origin server.
— Cloudflare, Encryption modes
Cloudflare recommends Full or Full (strict) whenever possible to avoid malicious connections to the origin. For end-to-end encryption with certificate validation, use Full (strict) after installing a valid origin certificate (Origin CA or a public CA).
Encryption mode comparison: which mode when
Section titled “Encryption mode comparison: which mode when”| Mode | Visitor → Cloudflare | Cloudflare → origin | Origin certificate |
|---|---|---|---|
| Off | Cleartext (HTTPS redirected to HTTP) | Cleartext | Not used for encryption |
| Flexible | HTTPS | HTTP | Not required on origin |
| Full | Matches visitor scheme | HTTP or HTTPS (no cert validation) | Any cert (even invalid) |
| Full (strict) | Matches visitor scheme | HTTPS with validation | Valid, trusted, matching hostname |
| Strict (SSL-Only Origin Pull) | Per visitor request | Always HTTPS with validation | Same as Full (strict); Enterprise only |
When you set your encryption mode to Full (strict), Cloudflare does everything in Full mode but also enforces more stringent requirements for origin certificates.
— Cloudflare, Full (strict)
Setting your encryption mode to Flexible makes your site partially secure. Cloudflare allows HTTPS connections between your visitor and Cloudflare, but all connections between Cloudflare and your origin are made through HTTP.
— Cloudflare, Flexible
Common conclusion: Encrypt and validate both hops when the origin supports TLS. Flexible is only for origins that cannot use TLS yet; if the origin redirects HTTP to HTTPS, Flexible commonly triggers redirect loops (see below). After Origin CA installation, Cloudflare directs you to select Full (strict) on the SSL/TLS overview page.
Automatic SSL/TLS vs Custom SSL/TLS
Section titled “Automatic SSL/TLS vs Custom SSL/TLS”New zones may use Automatic SSL/TLS, which probes the origin (user agent Cloudflare-SSLDetector) and ramps encryption mode upgrades gradually. It will not move to a less secure mode—for example, it will not drop from Full (strict) to Full when an origin certificate expires. You remain responsible for a valid origin TLS configuration. To pick the mode yourself, choose Custom SSL/TLS on the Encryption modes page.
Per-hostname encryption with configuration rules
Section titled “Per-hostname encryption with configuration rules”For specific hostnames instead of the whole zone, use a configuration rule with the ssl action parameter (off, flexible, full, strict, origin_pull).
Always Use HTTPS: redirect HTTP requests at the edge
Section titled “Always Use HTTPS: redirect HTTP requests at the edge”Even with an active edge certificate, visitors can still request resources over HTTP. Always Use HTTPS redirects all visitor requests from http to https for all subdomains and hosts in the application.
Always Use HTTPS redirects all your visitor requests from http to https, for all subdomains and hosts in your application.
— Cloudflare, Always Use HTTPS
When to enable Always Use HTTPS
Section titled “When to enable Always Use HTTPS”Enable it when the entire application supports HTTPS. If only some paths support HTTPS, do not turn it on globally; use a selective redirect instead (Cloudflare points to Redirect admin area requests to HTTPS as an example pattern in the same doc family).
Prerequisites from Enforce HTTPS connections:
- An active edge certificate (for example Universal SSL).
- SSL/TLS encryption mode is not Off.
-
In the Cloudflare dashboard, open SSL/TLS → Overview and confirm encryption mode is not Off.
-
Open SSL/TLS → Edge Certificates.
-
Turn Always Use HTTPS on.
-
Optionally enable via API:
PATCHzone settingalways_use_httpsto"on".
Cloudflare recommends not performing HTTPS redirects at the origin, because that can cause redirect loop errors and adds latency compared with edge redirects (Always Use HTTPS, Enforce HTTPS and encrypt all traffic).
Chrome’s Does not redirect HTTP traffic to HTTPS audit lists configuring redirects (including Cloudflare) after HTTPS is available on the server—same goal, verified from the client side.
Automatic HTTPS Rewrites: fix mixed content in HTML
Section titled “Automatic HTTPS Rewrites: fix mixed content in HTML”Forcing HTTPS with Always Use HTTPS does not fix mixed content: browsers check embedded resource URLs before fetching. Pages served over HTTPS that reference http:// assets may show warnings or blocked content.
Forcing HTTPS does not resolve issues with mixed content, as browsers check the protocol of included resources before making a request. You will need to use only relative links or HTTPS links on pages that you force to HTTPS.
— Cloudflare, Always Use HTTPS — Limitations
Automatic HTTPS Rewrites rewrites http to https in HTML for resources that Cloudflare verifies as available over HTTPS.
Automatic HTTPS Rewrites prevents end users from seeing “mixed content” errors by rewriting URLs from http to https for resources or links on your web site that can be served with HTTPS.
— Cloudflare, Automatic HTTPS Rewrites
Limits of Automatic HTTPS Rewrites
Section titled “Limits of Automatic HTTPS Rewrites”Before rewriting, Cloudflare checks that the HTTP resource is reachable over HTTPS. Passive content (such as images) may not be rewritten unless list data applies; JavaScript or CSS may still load HTTP URLs and trigger warnings (Automatic HTTPS Rewrites — Limitations). Fix remaining URLs in HTML (relative or https:// links) or follow Mixed content errors.
For API-only hostnames returning JSON, Cloudflare advises turning Automatic HTTPS Rewrites off—rewriting is unnecessary for non-HTML responses and can confuse clients that follow rewritten URLs (Discover and secure your API endpoints). HTML sites and mixed web/API zones can leave rewrites on; rewriting applies to HTML responses.
HTTP Strict Transport Security (HSTS): browser-side HTTPS only
Section titled “HTTP Strict Transport Security (HSTS): browser-side HTTPS only”HSTS adds a response header so compliant browsers use HTTPS only, including upgrading http links—protecting against protocol downgrade attacks.
HSTS protects HTTPS web servers from downgrade attacks. These attacks redirect web browsers from an HTTPS web server to an attacker-controlled server, allowing bad actors to compromise user data and cookies.
— Cloudflare, HTTP Strict Transport Security (HSTS)
Enable HSTS only after HTTPS works everywhere you need it. If you remove HTTPS before disabling HSTS or before the configured Max Age elapses, visitors can be locked out for that duration (HSTS requirements).
Cloudflare’s Enforce HTTPS and encrypt all traffic suggests starting HSTS with a 6-month max-age, moving to 12 months after stability, then considering preload (minimum 12 months; submit via hstspreload.org as referenced in that guide). Turn on Apply HSTS policy to subdomains only if every subdomain supports HTTPS.
Google Lighthouse describes a strong policy as Strict-Transport-Security: max-age=63072000; includeSubDomains; preload and recommends staged max-age increases (Use a strong HSTS policy)—the same gradual rollout idea as Cloudflare’s dashboard flow.
ERR_TOO_MANY_REDIRECTS: encryption mode and redirect conflicts
Section titled “ERR_TOO_MANY_REDIRECTS: encryption mode and redirect conflicts”Redirect loops happen when Cloudflare and the origin disagree on HTTP vs HTTPS.
This error occurs when visitors get stuck in a redirect loop.
— Cloudflare, ERR TOO MANY REDIRECTS
Typical patterns:
| Situation | What happens | Fix |
|---|---|---|
| Flexible + origin forces HTTPS | Cloudflare fetches origin over HTTP; origin redirects to HTTPS; loop | Remove origin HTTPS redirect or use Full / Full (strict) |
| Full or Full (strict) + origin forces HTTP | Edge sends HTTPS to origin; origin redirects to HTTP | Remove HTTP redirects at origin |
| Always Use HTTPS + origin HTTPS→HTTP | Edge upgrades to HTTPS; origin downgrades | Remove origin redirect or disable Always Use HTTPS |
| HSTS + mode Off or origin HTTPS→HTTP | Browser and edge fight over scheme | Fix encryption mode; remove conflicting origin redirects |
Review redirect rules so no rule sends HTTPS traffic to http:// URLs. Cloudflare Tunnel published apps with an http:// service URL hit the same class of problem when the origin always redirects to HTTPS.
Common mistakes
Section titled “Common mistakes”- Flexible mode on an origin that redirects all HTTP to HTTPS (Flexible — Limitations).
- Duplicate redirects at the origin while Always Use HTTPS is on (Stop account takeover attacks).
- Expecting Always Use HTTPS alone to clear mixed content without Automatic HTTPS Rewrites or HTML fixes (Encrypt all visitor traffic).
- Enabling HSTS preload or long max-age before every subdomain serves valid HTTPS.
- Full (strict) with an expired, mismatched, or untrusted origin certificate (visitor errors such as 526; see Set your encryption mode to Full (strict)).
- Leaving Automatic HTTPS Rewrites on for API-only zones (Discover and secure your API endpoints).
How to check this on your site
Section titled “How to check this on your site”-
In the Cloudflare dashboard, open SSL/TLS Overview and confirm Full (strict) (or your chosen custom mode) matches origin capabilities.
-
From a terminal, follow redirects:
curl -I -L https://your-domain.exampleand confirm HTTP URLs redirect to HTTPS without chains alternating schemes (Configure Cloudflare and Heroku over HTTPS). -
In Chrome, open DevTools → Security on an HTTPS URL and confirm the page is fully secure (no mixed content).
-
Run Lighthouse Does not use HTTPS and Does not redirect HTTP traffic to HTTPS audits (is-on-https, redirects-http).
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact wording you are asking about.