Get your free beta license ↗
Websites · Apache

A site behind Cloudflare loops with too many redirects

Last updated 30 Nov 2026
Summary

A site behind Cloudflare loops with ERR_TOO_MANY_REDIRECTS after UrbeStack forces HTTPS in Apache. Cloudflare's Flexible mode connects over HTTP and keeps getting redirected to HTTPS, so switch to Full (strict) to stop the loop.

Symptoms

The browser shows ERR_TOO_MANY_REDIRECTS or reports that the page isn't redirecting properly. This starts after you force HTTPS for a domain whose DNS goes through Cloudflare's proxy.

Cause

With forced HTTPS enabled, Apache's HTTP host on port 80 returns a 301 redirect to HTTPS for every request except certificate validation.

In Flexible mode, Cloudflare receives the visitor's HTTPS request and sends it to the server over HTTP on port 80. The server redirects to HTTPS, so the browser sends another HTTPS request to Cloudflare and the cycle repeats.

Resolution

  1. Set the domain's SSL/TLS mode in Cloudflare to Full (strict). Cloudflare then connects to the server over HTTPS, and the server presents its own certificate.

  2. UrbeStack can issue the certificate while Cloudflare's proxy is on. The certificate authority's validation request reaches the server through the proxy.

  3. You can also stop forcing HTTPS for the domain on the server.

    urbestack-domain-set --name example.com --force-https off
  4. Check the HTTP response.

    curl -sI http://example.com/
  5. With forced HTTPS enabled, the response is HTTP/1.1 301 Moved Permanently with a Location that starts with https://. Reload the site in your browser to check that the loop has stopped.