尝试通过 IIS 7.5 反向代理登录 Redmine 时出错

尝试通过 IIS 7.5 反向代理登录 Redmine 时出错

我正在尝试将 Redmine 设置为我们部门内部网站的子目录,并使用 IIS 的 URL Rewrite 扩展将其重新命名为“工作流”。

我已将其“运行”,因为它将为页面提供 URL 和 HTML 代码中所有正确的重写。但是,当我尝试提交表单(包括登录 redmine)时,IIS 会给我以下错误之一:

Your browser sent a request that this server could not understand.

或者

The specified CGI application encountered an error and the server terminated the process.

设置如下:

  • Redmine 使用 Bitnami 一体化安装程序安装在本地 Windows XP 机器上,其中包括:
    • 阿帕奇 2
    • Ruby on Rails 简介
    • MySQL
    • Redmine
    • 薄的
  • Redmine 在 http:/localhost/redmine 本地运行
  • Redmine 在内联网上运行 http:/146.18.236.xxx/redmine
  • Windows Server + IIS 7.5 提供 ASP.NET 内部网 Web 应用程序 mydept.mycompany.com
  • 已安装 IIS 扩展 URL 重写和 AAR
  • IIS 的反向代理设置(如下所示)用于在 mydept.mycompany.com/workflow 上为 Redmine 提供服务

<rewrite>
    <rules>
        <rule name="Route requests for workflow to redmine server" stopProcessing="true">
            <match url="^workflow/?(.*)" />
            <conditions>
                <add input="{CACHE_URL}" pattern="^(https?)://" />
            </conditions>
            <action type="Rewrite" url="{C:1}://146.18.236.xxx/redmine/{R:1}" logRewrittenUrl="true" />
            <serverVariables> 
                <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                <set name="ORIGINAL_HOST" value="{HTTP_HOST}" /> 
            </serverVariables> 
        </rule>
    </rules>
    <outboundRules rewriteBeforeCache="true">
        <clear />
        <preConditions>
            <preCondition name="isHTML" logicalGrouping="MatchAny">
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/plain" />
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/.*xml" />
            </preCondition>
            <preCondition name="isRedirection">
                <add input="{RESPONSE_STATUS}" pattern="3\d\d" />
            </preCondition>
        </preConditions>
        <rule name="Rewrite outbound relative URLs in tags" preCondition="isHTML">
            <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/redmine/(.*)" />
            <action type="Rewrite" value="/workflow/{R:1}" />
        </rule>
        <rule name="Rewrite outbound absolute URLs in tags" preCondition="isHTML">
            <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^(https?)://146.18.236.xxx/redmine/(.*)" />
            <action type="Rewrite" value="{R:1}://mydept.mycompany.com/workflow/{R:2}" />
        </rule>
        <rule name="Rewrite tags with hypenated properties missed by IIS bug" preCondition="isHTML"> <!-- http://forums.iis.net/t/1200916.aspx -->
             <match filterByTags="None" customTags="" pattern="(\baction=&quot;|\bsrc=&quot;|\bhref=&quot;)/redmine/(.*?)(&quot;)" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
            <action type="Rewrite" value="{R:1}/workflow/{R:2}{R:3}" />
        </rule>
        <rule name="Rewrite Location Header" preCondition="isRedirection">
            <match serverVariable="RESPONSE_LOCATION" pattern="^http://[^/]+/(.*)" />
            <conditions>
                <add input="{ORIGINAL_URL}" pattern=".+" />
                <add input="{URL}" pattern="^/(workflow|redmine)/.*" />
            </conditions>
            <action type="Rewrite" value="http://{ORIGINAL_URL}/{C:1}/{R:1}" />
        </rule>
    </outboundRules>
</rewrite>
<urlCompression dynamicCompressionBeforeCache="false" />

如果您能提供任何帮助,我将不胜感激。我感觉我已经很接近了,而且只是这里或那里的一个小设置,但我似乎无法让它工作。

答案1

我知道现在可能有点晚了,但是您是否在 IIS 管理器中选中了入站规则的“附加查询字符串”框?我遇到了很多奇怪的问题,直到我意识到我取消选中了这个框(根据一些博客的建议)。选中它似乎为我理清了一切(在配置为反向代理的 IIS 7 后面运行 Redmine 2.3.3)。

相关内容