Identifying mobile clients

Hi folks… I know CF offers an automatic redirection to mobile. We don’t use this feature because we already have this implemented on server-side logic.

However, does CF offer/plans to offer a request header identifying the client type so that we can decide what to do ourselves (instead of going through a kind of long decision tree on the server)?

Imagining this could be similar to CF_IPCOUNTRY (which we use because it’s a lot faster to use this than to convert IP addresses to numerical format and lookup in our database, which we still do CF_IPCOUNTRY is by any chance missing).

Let’s call it CF_PLATFORM perhaps?

Hi @freitasm,

We do have this feature but it’s currently part of our Enterprise service and also enables caching by device type, too:

Thanks for raising your interest in this - could you explain a bit more about your use-case. Would you do caching by device type, or something else?

1 Like

Thanks… No, not caching by device type. It’s just that the current redirection to mobile allows only DROP or KEEP path - which is ok if your URLs are the same.

In our case URLs are different because our mobile version was developed recently using a .NET framework with views - so we have while the full site is

Our logic identifies a mobile device and does a 301 redirect to the correct URL - a DROP or KEEP wouldn’t work. It’s already implemented but it’s something that can also easily be done with a URL Rewrite rule based on header values - which is faster since would be processed on the webserver, not on the application.

CF_PLATFORM would really just be used to save a few milliseconds that our logic spend testing UA strings and creating the redirection URL - meaning redirections could happen without touching the application, saving db access as well…

Not an immediate need really but something that would be nice to have (and make the application sleeker).

1 Like

Thanks for sharing - we can send the cf-device-type header but only on our Enterprise plan currently - I’ll make sure our product team see this feedback though.



is the header still enterprise only?

I just read a official github content (Google Chrome Editors) which says about User-Agent things. They emphasis on mobile header also. So website developers can know if the client is a mobile user or not.

The Sec-CH-UA-Mobile header field represents whether the user agent should receive a specifically “mobile” UX.

Cloudflare provide cf-device-type only on the enterprise. Maybe its time to giveaway to free :innocent: