Making server-side choices based on client-side information is a bit of a modern day holy grail. Client-Hints will hopefully someday make that easier, but we don’t have that yet. I’m a fan of the cookie-based approach. This polyfill by Jonathan Neal aims to replicate Client-Hints with the cookie-based approach.
Client-Hints Polyfill
DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!