我不确定这是正确的方法......我正在使用Spring,Tomcat7,Linux 在我的Linux服务器上,我有一个防火墙,有这些规则
端口8081仅对SERVER1开放 端口8443对所有IP开放
我想限制仅从SERVER1访问某些资源(URL1)。 但是用户可能会尝试通过端口8443访问URL1,我不希望这样。 我怎样才能将对URL1的访问权限仅限于SERVER1。我想检查请求是否到达端口8443而不是8081.拒绝它
可以这样做吗?
Ok. i found out i could use: org.apache.catalina.filters.RemoteAddrFilter
I've added this filter to my "web.xml" file. which means: restrict requests only on port 8081...but now i always get:
"Access to the specified resource has been forbidden"
What i'm i missing?
<filter>
<filter-name>Remote Address Filter</filter-name>
<filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
<init-param>
<param-name>allow</param-name>
<param-value>((\d{1,3}(-\d{1,3})?|x)\.){3}(\d{1,3}(-\d{1,3})?|x):8081</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Remote Address Filter</filter-name>
<url-pattern>/snabel/myService</url-pattern>
</filter-mapping>
谢谢, Snabel