Monday, April 7, 2025

How I Fixed ERR_TOO_MANY_REDIRECTS with Cloudflare + Vercel

Programming LanguageHow I Fixed ERR_TOO_MANY_REDIRECTS with Cloudflare + Vercel


Last week, while working on my project ReadmeChef, I ran into a frustrating issue — my live website suddenly broke and started throwing this error:

After some digging, I found out the issue was caused by a misconfiguration between Cloudflare and Vercel. Here’s the fix that worked for me.


⚡ TL;DR – The Quick Fix

If you’re using Cloudflare to manage your domain and hosting your site on Vercel, check your SSL/TLS settings in Cloudflare.

By default, Cloudflare sets the SSL/TLS mode to Flexible, which caused the redirect loop in my case. Simply switching it to Full will solve the issue instantly.

Solution


🧩 Why This Happens

Cloudflare offers several SSL modes, and the Flexible mode can often lead to trouble when paired with platforms like Vercel.

Here’s what Flexible mode does:

  • Client → Cloudflare: HTTPS
  • Cloudflare → Origin (Vercel): HTTP

But Vercel forces HTTPS on all connections. So here’s what ends up happening:

  1. Cloudflare tries to connect to Vercel over HTTP
  2. Vercel redirects the connection to HTTPS
  3. Cloudflare keeps trying HTTP
  4. Loop begins
  5. Browser throws ERR_TOO_MANY_REDIRECTS

By switching the SSL mode from Flexible to Full, Cloudflare connects to Vercel over HTTPS directly, preventing the redirect loop.

🔒 Full = end-to-end HTTPS (Cloudflare to user and Cloudflare to origin)


💡 Final Thoughts

If you’re using Cloudflare with Vercel (or really any host that enforces HTTPS), always double-check your SSL/TLS mode. Avoid using Flexible unless you absolutely need it.

Hope this saves you the same headache I had! Let me know if you’ve run into this before or have any other tips.

Check out our other content

Check out other tags:

Most Popular Articles