A redirect loop occurs when a website continuously redirects itself to a page that in turn redirects back indefinitely.
When Can a Redirect Loop Occur?
Most often, incorrect cookie management or the lack of cookies can cause a redirect loop. In such cases, the issue may only be resolvable on the browser side by deleting cookies. However, if this happens, it’s worthwhile to investigate the circumstances under which it occurred and correct the error on the server side as well.
Poor SSL configuration can also lead to a redirect loop. If you're using a proxy (like Cloudflare) and the connection between the proxy and the server isn't encrypted, WordPress might perceive that SSL isn't active and redirect to the https:// version.

However, since WordPress won't detect SSL on subsequent page loads (because there's no encryption between the proxy and the server), despite the browser displaying https://example.com, the proxy will continuously call http://example.com on the server.
You can correct this by ensuring the proxy connects to the server via SSL (using a self-signed certificate if necessary), or by adding the following line to your wp-config.php:
$_SERVER['HTTPS'] = 'on';
This approach, even though the connection between the proxy and the server isn't encrypted, tricks WordPress into believing it is, thereby ending the redirect loop.