Infinite Redirect

I am trying to setup a basic website using caddy and I finished the configuration. Though whenever I visit the website there is an infinite redirect. The website is only HTML.

Firefox says:

"The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Caddy file:

domain.com {
    root /var/www/domain
    gzip
    log /var/www/logs/domain_access.log {
        rotate {
            keep 5
        }
    }
}

I have caddy started via a systemd service file. Not quite sure what would be causing the infinite redirect. If it matters, I do also have cloudflare in front of it.

What happens when you curl https://domain.com?

The response would be helpful to see.

curl https://domain.com
<a href="https://domain.com/">Moved Permanently</a>.

Turn on strict https in your cloudflare settings.

1 Like

that did it.

Why does it cause an issue?

Because otherwise CloudFlare keeps trying to send HTTP requests to Caddy while Caddy just keeps replying with 301’s to HTTPS. But since you’re already using HTTPS provided by CloudFlare it would just keep trying to redirect infinitely.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.