Do a time based redirect in cloudflare workers?

Hey @aayush23467 - interesting problem! I worked up a little example, making use of the Date class in JS to fetch from two different URLs based on the current hour. Note that it’s currently set to the timezone “America/New_York”, so you’ll need to adjust accordingly.

Here’s the preview code in our Workers playground!

3 Likes