Home JBoss howto Configuration How to restrict access to JBoss web application by IP or Host?
30 | 07 | 2010
JBoss 5 AS Book
"JBoss AS 5 development" reviews
Please share your feedback/review with other readers!
Banner
Dashboard
Advertise with Us
Banner
RSS Feed
Java EE 1.6 resources
Login
Sign here for the NewsLetter.



JBoss admin resources
Banner
Java EE 1.6 resources
JBoss howto

How to avoid the 50 seconds start up limit in Eclipse ?

JBoss recipe of the day ...
Read More

How can you solve deployment errors caused by large war/jar/ear files ?

jboss recipe of the day ...
Read More

How do you configure your .war to be deployed after your EJB ?

jboss recipe of the day ...
Read More
How to restrict access to JBoss web application by IP or Host?
Written by Mark S.   

jboss recipe of the day

You can create easily Access control list based on the IP address/Host name using Tomcat Valves. A Valve element represents a component that will be inserted into the request processing pipeline for the associated Catalina container.

The Remote Address Filter allows you to compare the IP address of the client that submitted this request against one or more regular expressions, and either allow the request to continue or refuse to process the request from this client.
For example, to block all requests coming in except those from the local host:

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1" />
 

The Remote Host filter is much like the Remote Address Valve, except it allows you to compare the remote host address of the client that submitted this request instead of the fixed IP address. A Remote Host filter can be associated with a Tomcat Engine , Host, or Context container. An example entry using the org.apache.catalina.valves.RemoteHostValve can be found in the following code snippet.

<Valve className="org.apache.catalina.valves.RemoteHostValve" deny="badhost*"/>

This valve entry denies access to the assigned container for the host whose name starts with badhost. If I assign this valve entry to the host container localhost, then all clients beginning with badhost will see a 403 - Forbidden page.

 

JBoss.org Search
Custom Search
Comments
Search
rafaelcba   |2009-05-11 14:51:08
Hello.

How can i use this Valve element in one specific WebApp? Can I put it in
jboss-web.xml inside my WAR?
admin   |2009-05-11 14:58:31
Your question is quite interesting. However I have just checked jboss-web.xml
DTD and it's not mentioned anything about Valves. So I think it's possible to
configure it only at server level
regards
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."