从Jboss7迁移到Wildfly:只允许从特定IP访问servlet [英] Migration from Jboss7 to Wildfly: allow access to servlet only from specific IPs
问题描述
我正在将应用程序从JBoss7迁移到Wildfly。
I'm migrating an application from JBoss7 to Wildfly.
在JBoss上我允许使用<$ c $从特定IP访问其中一个servlet c> valve jboss-web.xml中的元素
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>
我想在wildfly中重现此功能,但我找不到相应的功能。
I would like to reproduce this functionality in wildfly but I cannot find an equivalent function.
推荐答案
Undertow,WildFly中的新网络服务器,不支持Valves(来自Tomcat)。
Undertow, a new webserver in WildFly, doesn't support Valves (which come from Tomcat).
如果您不需要在服务器级别进行过滤(即,如果部署级别足够),那么您可以简单地实现具有相同功能的servlet过滤器。这是Servlet规范涵盖的可移植解决方案。
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.
查看简单过滤器示例。
这篇关于从Jboss7迁移到Wildfly:只允许从特定IP访问servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!