Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Tomcat and the fly likes Can I block access to a Tomcat Server from IE6? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Can I block access to a Tomcat Server from IE6?" Watch "Can I block access to a Tomcat Server from IE6?" New topic

Can I block access to a Tomcat Server from IE6?

Jens Heinitz

Joined: Sep 02, 2013
Posts: 1


I would like to know if it is possible to block access to a Tomcat server if the uses uses Internet Explorer 6. Our application requires Internet Explorer 8 and accessing it with IE6 can lead to some kind of trouble, so we are looking for a configuration option which allows us to define valid and/or invalid frontends.

Thanks and best regards

Karthik Shiraly

Joined: Apr 04, 2009
Posts: 874

Every browser reports a unique string called the "user agent string" (see a list here). By examining the user agent string, it's possible to filter out specific browsers and versions. IE strings are found here. The user agent string is sent from browsers as a HTTP request header with every HTTP request. It's also available via javascript for client side code.

On the server side, one way to filter is by writing a custom Valve which examines the user agent string. However, Valves are Tomcat specific, and are relatively rare in the field. So writing a valve may lead to code maintenance issues in future.

A better way, in my opinion, is to write a servlet filter which does the same. Servlet filters are part of the servlet standards, and hence compatible across servlet containers.

One more way, if using spring framework, is spring interceptors.

Instead of repeating the details, I'll just [url=]link to an article[/link] that already shows how to do this.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

Karthik has already detailed out, how to identify the browser/version.

Once you have done identifying, it might be a nice touch to also provide a download link for IE8 (or whatever minimum IE version you support) or better yet, Chrome! Identifying the problem and providing a solution to the end user = good usability

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Can I block access to a Tomcat Server from IE6?
It's not a secret anymore!