Directing traffic depending on OS of phone

Hi there

I need to forward traffic arriving at a particular address (a subdomain) to different places depending on whether it is being accessed from an Android phone or Apple iPhone.

To explain, we have a QR code on the packaging of our product that customers scan in order to find our app - it sends traffic to a sub-domain and then, from there, I want to send it to either the Google Play Store or to the Apple App Store depending on device type. We had this functionality with a previous host - we had a web service running that handled it. I can’t see how to achieve the same thing with Cloudflare - can anyone help?

Many thanks in advance


You can use a Worker script, where you’ll simply change the redirect based on the reported user agent.

Hi Sandro and MANY thanks for your quick reply. Sorry to sound ignorant but I’m a mere marketer, not a technical person - is this something for an expert user to do or could a novice manage it with suitable instruction?

Thanks again, really appreciate it.

Kind regards


Depends on what you consider an expert and novice respectively :slight_smile:

It will require some JavaScript code which you need to upload to Cloudflare and map to the URL in question, so that it gets executed every time a request is received. Also, if you require more than what the free limits of Workers include, this will turn into a paid feature.

Overall it probably is not too difficult, but it does require a certain level of experience with JavaScript and HTTP requests.

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