如何使用 IP 过滤器保护 Orbeon Form Runner?

How can I secure Orbeon Form Runner with an IP filter?

documentation here 描述了如何使用 IP 过滤器保护 Form Runner。我按照以下说明进行操作:

  1. 将 urlrewrite-3.2.0.jar 放入 Orbeon Forms WEB-INF/lib 文件夹
  2. 在 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>
  1. 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,所以我得到了 404.

http://myserver.mydomain.com/unauthorized

我尝试将 temporary-redirect 的值更改为 /%{context-path}/unauthorized,但随后我被重定向到 http://orbeon/unauthorized。我也试过 %{context-path}/unauthorized 但后来我得到一个 "too many redirects" 错误。

知道如何解决这个问题吗?

我能够让 IP 过滤器简单地 return 一个 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