Too Many Redirects error after switching to Cloudflare

  1. Check SSL/TLS Settings in Cloudflare:
  • Go to your Cloudflare dashboard.
  • Navigate to the SSL/TLS section.
  • Ensure the SSL mode is set to one of the following:
    • Flexible: If your server does not have an SSL certificate installed.
    • Full or Full (Strict): If your server has an SSL certificate installed.
    Note: Using “Flexible” mode while your server is expecting HTTPS requests can cause a redirect loop.
  1. Ensure Server Redirects Are Correct:
  • If your server is forcing HTTPS using a redirect (e.g., in your .htaccess, Nginx, or web server settings), make sure it aligns with the Cloudflare SSL mode.
  • If you are using Full or Full (Strict) in Cloudflare, make sure your server is also set to serve content over HTTPS.
  1. Check for Mixed Content Redirects:
  • If your site is redirecting between HTTP and HTTPS, it can cause a redirect loop.
  • You can use Cloudflare’s “Automatic HTTPS Rewrites” feature to fix this:
    • In your Cloudflare dashboard, go to SSL/TLS > Edge Certificates, and enable Automatic HTTPS Rewrites.
  1. Clear Cache:
  • Clear both your browser cache and Cloudflare cache. In Cloudflare, go to Caching > Configuration and click on Purge Everything.

Once you’ve adjusted these settings, try accessing your site again.

See also  How to Deploy Locally Developed Laravel Projects to AWS: A Step-by-Step Guide

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.