Error attempting to log into Redmine through IIS 7.5 Reverse Proxy

Posted by dneaster3 on Server Fault See other posts from Server Fault or by dneaster3
Published on 2013-09-30T21:56:43Z Indexed on 2013/10/21 21:55 UTC
Read the original article Hit count: 376

Filed under:
|
|
|

I am trying to set up Redmine as a subdirectory of our department's intranet site, and also to rebrand it as "Workflow" using IIS's URL Rewrite extension.

I have it "working" in that it will serve the page with all the correct rewrites in both the URL and the HTML code. However, when I try to submit a form (including logging in to redmine), IIS gives me one of the the following errors:

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

or

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

Here's the setup:

  • Redmine installed on a local Windows XP machine using the Bitnami all-in-one installer, which includes:
    • Apache 2
    • Ruby-on-Rails
    • MySQL
    • Redmine
    • Thin
  • Redmine runs locally at http:/localhost/redmine
  • Redmine runs over the intranet http:/146.18.236.xxx/redmine
  • Windows Server + IIS 7.5 serving up an ASP.NET intranet web application mydept.mycompany.com
  • IIS Extensions Url Rewrite and AAR installed
  • Reverse proxy settings for IIS (shown below) to serve Redmine at mydept.mycompany.com/workflow

<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" />

Any help that you can provide would be appreciated. I get the impression that I'm close adn that it is just one little setting here or there, but I can't seem to make it work.

© Server Fault or respective owner

Related posts about apache2

Related posts about iis7.5