> When I got started with the web 15 years ago, it was advised everywhere not to rely on user agent strings and rely on feature detection instead,
Which is reasonable advice for a code running in a browser, not for a proxy/CDN (and you don't want proxy inserting it's own js).