简体   繁体   中英

How to detect browser with ambassador gateway routing or cloudflare?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM