Configuring Domain based on user device

hi i have a scenario to discuss, can someone help me how to load sites based on user device?

if my desktop site is configured on 1.1.1.1 or CNAME1
and framework7 site is configured on 2.2.2.2 or CNAME2

how can I configure my domain.com to load content from 2.2.2.2 if the user agent is mobile?

Hi @creativebrandgurus,

Are you saying that you want to send the requests to a different server based on the User Agent? If so, there is not a built in feature for that and you would need to use Workers.

https://developers.cloudflare.com/workers/runtime-apis/request

Though I believe that if it’s just mobile users you want to redirect, you can send them to a subdomain in your zone.

1 Like

Not exactly,

i dont want to load from subdomain

i have a website on Wordpress
which is good for desktop
and for mobile its responsive

but I want to create a separate PWA webapp and publish it on a different server
and redirect mobile users to PWA webapp instead of serving the responsive website or redirect to subdomain.

the user should not feel the difference in change of content

eg:
yatra.com - see their desktop website and their mobile responsive website
same yatra.com if browsed through mobile is serving a well optimized PWA

Ok, in that case, you’ll need to use a Worker if you want it to be the same hostname.

1 Like

Hi,

can you provide step by step guide to follow
ill try and post the results here

I doubt anyone is going to write your worker for you, unless you hire a freelancer.

In my first reply, I posted a link to the documentation, there is a template for resolve override, so you would need to start with that and implement the logic based on UA.

1 Like

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