Theme Switcher Not Working After Migrating to Cloudflare Workers

Sure, here’s a cleaned-up version of your post:


Hey everyone,

I recently migrated my site from Netlify and set it up in Cloudflare Workers. While testing and troubleshooting, I noticed a strange issue. I have a theme switch function that allows users to toggle between dark and light modes. This function works perfectly on the development pages but not when the website is served through my domain names.

I’ve tried tweaking various settings individually, like cache, HTTPS, etc., to see if any of them would resolve the issue, but nothing has worked so far. The website itself functions correctly because updates are reflected immediately. However, the theme switcher does not work with the domain names.

Everything worked fine on Netlify, and my domain name was registered with Cloudflare. The only change is that I now host the website with Cloudflare as well.

Any ideas on how to fix this?

I also have two more domains that redirect to the same site and the issue is the same with those

sibrahim.co