Worker not getting triggered

Hello Team,

We have created a Worker and this Worker Redirects based on Country IP, We have added a route

Worker Script attached as an image

In India when the user types xperimentor it is redirecting to destination URL

however when user from USA tries it is showing page not loading


Router added as below

You’re redirecting people from the US from to - this is just going to loop, isn’t it?

What’s the purpose of redirecting them to the same URL they requested?

Hello KianNH, yah the requirement is that if anybody accessing xperimentor in US it should redirect to the same site and in India it has to redirect to targeted url…you are right…can you please guide or is there any workaround or solution…Thanks in Advance

You shouldn’t redirect to the same site, that will loop infinitely and browsers won’t load it.

There’s no reason to have US in your country map if you’re not going to redirect them somewhere else, just remove them and let it fall through to the return fetch(request);

1 Like

Hello KianNH,

Thank you for the response…did the changes and it is working

Thanks Again

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.