# A site behind Cloudflare loops with too many redirects

UrbeStack sysadmin note about Apache. Last updated 30 Nov 2026.

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

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.

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

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

```
urbestack-domain-set --name example.com --force-https off
```

Check the HTTP response.

```
curl -sI http://example.com/
```

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.

If the problem persists after you follow this note, you can [open a support ticket](https://support.urbestack.com/new?type=support). Including the output of the commands you ran helps support diagnose the problem.
