1

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.

dneaster3
  • 11
  • 2

1 Answers1

1

I realize that it may be a little late, but have you checked the box to "append query string" for the inbound rule in IIS Manager? I had a lot of strange problems until I realized that I had un-checked this box (on the advice of some blog). Checking it seemed to sort things out for me (running Redmine 2.3.3 behind IIS 7 configured as reverse proxy).

bradstreet
  • 11
  • 1
  • I'll give it a try. I ended up abandoning this for now simply because I could not get it working and the friendly URL was a "nice to have". – dneaster3 Oct 22 '13 at 14:47