How to detect browser with ambassador gateway routing or cloudflare?

6/26/2019

I have an angular application running behind cloudflare and ambassador gateway routing deployed with kubernetes. What I want to do is to check from which browser the application is receiving the traffic and match it against the list of supported browsers I have. If the browser does not match, I would like to throw a static html page which says, sorry we don't support this browser and please follow the steps to upgrade your browser, etc.

Now, there are many solutions to achieve this exact same thing but, I have a hard requirement to block my website completely for unsupported browsers.

I can easily do it within my application but, why should the whole angular application be loaded just to deny access to my website. It would be really great to block the users from the root itself. Problem is that I don't have nginx, haproxy, etc in which case it would have been fairly simple and straightforward to implement this. Instead, I have cloudflare and ambassador of which I have least experience in.

Could someone please guide me on how can I achieve browser detection and redirection based on some conditions with cloudflare or ambassador?

-- user3895143
ambassador
browser-detection
cloudflare
kubernetes

1 Answer

7/7/2019

Not sure if this is what you want, but you can configure Cloudflare to block/challenge specific user-agents using User-Agent Rules. Additionally, Firewall Rules can also be created to match incoming requests with specific user agents to be blocked/challenged/allowed and you can combine it with other expressions.

-- FaizAzhar
Source: StackOverflow