Have to enable "follow redirects" to be healthy

Hi, there. My site is HTTPS. In health checks, my site’s status is unhealthy unless I check the “follow redirects”. I will get a 301 error if the “follow redirects” box is unchecked. Why is that?

You have 200 set as the expected code. However, the health check is getting a redirect code. As you don’t have it set to follow redirects, it doesn’t follow the redirect to get a 200 from the target of the redirect.

With Follow Redirects selected, instead of reporting a 301 or 302 code as unhealthy, the health check follows redirects to the final endpoint. Manage monitors · Cloudflare Load Balancing docs

1 Like

Thanks, but why is my site redirecting? Directing to where?

What hostname/IP do you have set for the Origin in your health check?

My site’s public IP.

If you navigate to that IP (i.e. in your Web browser, what happens, are you redirected? Perhaps, use the hostname of your Web site in the Origin field instead of its IP.

Thanks. I will be blocked because in Digital Ocean I have a firewall established to allow access only through Cloudflare’s IP addresses.

Is the hostname “example.com” or “https://www.example.com”?

You’d just put the domain itself in the Origin field of the health check.

If you navigate to https://example.net in your Web browser, you’d put “example.net” in the Origin field. If you navigate to https://www.example.net in your Web browser, you’d put “www.example.net” in the Origin field.

Use whatever your actual domain is.

1 Like

Thanks. In the Origin field, I now have example.com, and I’ve unchecked the “follow redirects” box. The status immediately became unhealthy. Why is my site redirecting with the host name?

Is it the same hostname as seen in the Host field of this screen capture? If so, be sure to put www.example.net and not just example.net in the Origin field. Your naked domain (i.e. example.net) is redirecting to www.example.net.

1 Like

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