documentation here描述如何使用 IP 过滤器保护 Form Runner。我按照以下说明进行操作:
- 将 urlrewrite-3.2.0.jar 放入 Orbeon Forms WEB-INF/lib 文件夹
- 在 Orbeon Forms WEB-INF/web.xml 中配置过滤器
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
- 将
urlrewrite.xml
配置放入 Orbeon WEB-INF 文件夹
<?xml version="1.0" encoding="utf-8"?>
<urlrewrite>
<rule>
<condition type="remote-addr" operator="notequal">0:0:0:0:0:0:0:1%0</condition>
<condition type="remote-addr" operator="notequal">127.0.0.1</condition>
<set type="status">403</set>
<to type="temporary-redirect" last="true">/unauthorized</to>
</rule>
</urlrewrite>
如果我从本地主机访问此 URL,它会按预期正常工作:
http://myserver.mydomain.com/orbeon/fr/
如果我从其他地方访问它,我将无法访问 Form Runner,这很好,但重定向无法正常工作。我最终被重定向到以下 URL,该 URL 不包含应用程序上下文,因此我得到了 404。
http://myserver.mydomain.com/unauthorized
我尝试将 temporary-redirect
的值更改为 /%{context-path}/unauthorized
但随后我被重定向到 http://orbeon/未经授权
。我还尝试了 %{context-path}/unauthorized
但随后出现“重定向过多”错误。
知道如何解决这个问题吗?
最佳答案
我能够让 IP 过滤器简单地返回 403,而不重定向 URL。就我而言,这是更可取的。
<?xml version="1.0" encoding="utf-8"?>
<urlrewrite>
<rule>
<condition type="remote-addr" operator="notequal">0:0:0:0:0:0:0:1%0</condition>
<condition type="remote-addr" operator="notequal">127.0.0.1</condition>
<set type="status" last="true">403</set>
<to>null</to>
</rule>
</urlrewrite>
我找到了to>null</to>
此处的示例列表:http://tuckey.org/urlrewrite/manual/4.0/guide.html
关于java - 如何使用 IP 过滤器保护 Orbeon Form Runner 的安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37557328/