Paolo Brandoli
Paolo Brandoli

Reputation: 4728

Migration from Jboss7 to Wildfly: allow access to servlet only from specific IPs

I'm migrating an application from JBoss7 to Wildfly.

On JBoss I was allowing the access to one of the servlet from specific IPs using the valve element in jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <context-root>/test-war</context-root>
  <valve>
    <class-name>org.apache.catalina.valves.RemoteAddrValve</class-name>
    <param>
      <param-name>allow</param-name>
      <param-value>127\..*\..*\..*,0:0:0:0:0:0:0:1%0</param-value>
    </param>
  </valve>
</jboss-web>

I would like to reproduce this functionality in wildfly but I cannot find an equivalent function.

Upvotes: 0

Views: 989

Answers (1)

kwart
kwart

Reputation: 3164

Undertow, a new webserver in WildFly, doesn't support Valves (which come from Tomcat).

If you don't need to do filtering on a server level (i.e. if the deployment level is sufficient), then you can simply implement servlet Filter with the same functionality. This is portable solution covered by Servlet specification.

Look at simple filter example with hardcoded IP range.

Upvotes: 2

Related Questions