How to Fix the WordPress HTTPS Redirect Loop When Using a Reverse Proxy with WP Force SSL

November 01, 2026 by Andrew Smith

Fix the redirect loop by making WordPress see the original HTTPS request from the reverse proxy. When TLS ends at Cloudflare, Nginx, Apache, HAProxy, Traefik, or a load balancer, the backend WordPress site may receive plain HTTP and panic. WP Force SSL then pushes it back to HTTPS again. That cycle repeats until the browser shows “too many redirects.” WordPress powers about 43% of all websites, so this is not a rare edge case [source: W3Techs].

TLDR: A WordPress HTTPS redirect loop behind a reverse proxy usually means the proxy is not passing the real protocol to WordPress. For example, Cloudflare receives https://example.com, but your server sees http://example.com, so WP Force SSL keeps redirecting forever. In one common support case, every page request becomes 5 to 20 repeated 301 redirects before the browser quits. Set the right proxy headers, update wp-config.php, and make sure only one layer controls SSL redirects.

Why WP Force SSL Loops Behind a Reverse Proxy

WP Force SSL is built to force secure HTTPS access and help fix mixed content problems. The premium site, WP Force SSL, also focuses on SSL monitoring and related tools. The plugin is not usually the real problem here. The problem is that WordPress receives the wrong request data.

A reverse proxy often accepts the public HTTPS connection, then sends the request to WordPress over HTTP inside your private network. That setup is normal. It is also safe when configured well. But WordPress needs a clear signal that the visitor used HTTPS.

If that signal is missing, WordPress thinks:

  • The visitor requested an insecure HTTP page.
  • WP Force SSL should redirect the visitor to HTTPS.
  • The proxy sends the next request back to WordPress as HTTP again.
  • The same redirect fires again.

Honestly, it feels like the site is arguing with itself. The browser just gives up.

Step 1: Confirm It Is a Redirect Loop

Before editing files, confirm the symptom. Open Chrome DevTools, go to the Network tab, and reload the page. You will usually see repeated 301 or 302 responses.

You can also run this from a terminal:

curl -I https://example.com

If the response keeps pointing back to the same HTTPS address, you likely have a proxy header issue. Expect to waste time here if you only clear cache. Cache is not the root cause in most cases.

Step 2: Pass the Correct HTTPS Header from the Proxy

Your proxy must send the original protocol to WordPress. For Nginx, add this inside the proxy location block:

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-SSL on;
proxy_set_header Host $host;

If your Nginx proxy terminates SSL and always forwards to WordPress over HTTP, you may prefer:

proxy_set_header X-Forwarded-Proto https;

For Apache reverse proxy setups, use:

RequestHeader set X-Forwarded-Proto "https"

For HAProxy, a common option is:

http-request set-header X-Forwarded-Proto https if { ssl_fc }

The exact syntax depends on your stack. The goal is simple: WordPress must receive a header saying the outside request used HTTPS.

Image not found in postmeta

Step 3: Tell WordPress to Trust the Proxy Header

Next, edit wp-config.php. Add this above the line that says /* That's all, stop editing! */:

if (
    isset($_SERVER['HTTP_X_FORWARDED_PROTO']) 
    && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false
) {
    $_SERVER['HTTPS'] = 'on';
}

If you use Cloudflare, this version can help too:

if (
    isset($_SERVER['HTTP_CF_VISITOR']) 
    && strpos($_SERVER['HTTP_CF_VISITOR'], 'https') !== false
) {
    $_SERVER['HTTPS'] = 'on';
}

This tells WordPress that the request is secure. WP Force SSL then stops firing the same redirect again and again.

Step 4: Set WordPress URLs to HTTPS

Log in to WordPress if you can. Go to Settings > General. Check these two fields:

  • WordPress Address (URL)
  • Site Address (URL)

Both should start with https://.

If the admin area is locked by the loop, set them in wp-config.php:

define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');

Replace example.com with your real domain.

Step 5: Avoid Double SSL Redirects

Do not force HTTPS in five places unless you know exactly why. Pick one main control point.

Check these layers:

  • WP Force SSL settings.
  • Nginx or Apache redirect rules.
  • Cloudflare “Always Use HTTPS.”
  • Load balancer redirect rules.
  • .htaccess custom redirects.

It drives me crazy that one old .htaccess rule can add ten minutes to a simple fix. Look for redirects that send HTTP to HTTPS, HTTPS to another host, or non-www to www. They must agree with each other.

Step 6: Flush Cache and Test Again

After saving changes, clear all cache layers:

  • WordPress cache plugin.
  • Server cache.
  • CDN cache.
  • Browser cache.

Then test again with:

curl -I https://example.com

A healthy response should show one final 200, or at most one clean redirect to the preferred host. For example, https://example.com may redirect once to https://www.example.com. That is fine. Ten repeated redirects are not.

Safe Working Order

  1. Back up wp-config.php.
  2. Add the proxy HTTPS header.
  3. Add the WordPress HTTPS detection snippet.
  4. Set both WordPress URLs to HTTPS.
  5. Disable duplicate SSL redirects.
  6. Clear cache and retest.

The fix is usually small, but the order matters. WP Force SSL can work well behind a reverse proxy. It only needs WordPress to receive the truth: the visitor already arrived over HTTPS.