« Previous Next »

Thread: ARR proxying POST requests

Last post 05-26-2009 2:29 PM by anilr. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 05-19-2009, 11:26 AM

    • njhansen
    • Not Ranked
    • Joined on 05-01-2009, 9:03 PM
    • Posts 7

    ARR proxying POST requests

    I think I might have run across a bug in ARR, but I'm not certain.

    We have a folder <mydomain>/script that is an application folder; it contains several ASP.Net pages. I also have a rule to proxy everything that is not an ASP.Net page to another server. We are in the midst of translating from an older web technology to .Net, and the pages that are not yet translated need to be served by the old server.

    All is well as long as the HTTP request is a GET; as soon as I POST, though, I get a 502.3 gateway timeout. A packet trace indicates that IIS is relaying the headers, but not the form content. Since the backend server never receives the form data, it never responds.

    All is also well for several other folders that are not application folders. In order to replicate the issue, the folder in question seems to need to be an application, and the request a POST.

    I've been able to get parts of it to work (by faking rules for another previously unused and completely non-existent folder that point to the backend server), but a complete solution would probably involve refactoring one project or the other.

    Configuration items to do the proxy below:

    From applicationHost.config:
            <applicationRequestRouting>
                <protocol httpVersion="Http11" keepAlive="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="true" addXForwardedForHeader="false" />
            </applicationRequestRouting>

    Associated URLRewrite rule from web.config:
                    <rule name="PCC A4D" enabled="true" stopProcessing="true">
                        <match url="^script/(.*)" />
                        <conditions>
                            <add input="{REQUEST_URI}" negate="true" pattern=".*(\.aspx|\.axd).*" />
                        </conditions>
                        <action type="Rewrite" url="http://testa4d.pcci.edu/4DCGI/{R:1}" appendQueryString="true" />
                    </rule>

    1. Is this a known issue?
    2. Is there some better workaround than moving the project into another folder to remove the conflict (and trying to find all the links that the move breaks)?
  • 05-19-2009, 11:57 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: ARR proxying POST requests

    It is possible that your asp.net application is reading the form content and hence it is not available for ARR to send - can you collect "failed request tracing" log for the request in question - just use 200-999 status-code as the failure condition.  One possible workaround for this may be to use globalRules instead of rules in url-rewrite - this will cause the url to be rewritten much earlier and should cause asp.net code to not even be invoked.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 05-19-2009, 12:34 PM In reply to

    • njhansen
    • Not Ranked
    • Joined on 05-01-2009, 9:03 PM
    • Posts 7

    Re: ARR proxying POST requests

    Making it a global rule, at least on first attempt, did not work; I get

    The virtual path 'null' maps to another application, which is not allowed.

    I'll poke at it a bit to see whether I can get it to work.

    I had already looked at the failed request log, but perhaps I missed something important. As expected, it is returning a 502.3 with an error code indicating connection timeout. Is there something else in particular I should look for? The whole thing is obviously quite long, but here is the section related to the error itself:

    282. r MODULE_SET_RESPONSE_ERROR_STATUS
    Warning
    ModuleName="ApplicationRequestRouting", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="3", ErrorCode="2147954417", ConfigExceptionInfo=""
    16:17:58.434
    283. r SET_RESPONSE_ERROR_DESCRIPTION
    Warning
    ErrorDescription="The operation has been canceled
    "
    16:17:58.434

    I don't see anything obviously related to any ASP.Net code running in the log, but your explanation sounds at least plausible. I'm not sure how to prevent it, though, since the proxied page is .HTML, not .ASPX, so it shouldn't be invoking the .Net handler anyway. The handler before ARR touches it is SSI-htm.

  • 05-19-2009, 12:41 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: ARR proxying POST requests

    Please e-mail me the freb log with your original configuration to anil (dot) ruia (at) microsoft (dot) com - please make sure that the "RequestRouting" area is selected under "WWW Server" provider in the areas to log for your rule.  If that area does not show up (eg if you installed freb after installing ARR), you may have to run repair on the ARR setup.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 05-26-2009, 2:29 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: ARR proxying POST requests

    This turned out to be combination of using .Net 3.5 (which installs a managed module called ScriptModule which runs for all requests including non-asp.net requests) and this asp.net tracing feature - the combination caused asp.net to consume the request entity when the managed module was called.  The fix was to either turn off the tracing or to add a preCondition="managedHandler" to the ScriptModule entry in system.webServer/modules.  The problem was not ARR specific in any way and would affect any non-asp.net content running in the same application with asp.net configured in this way.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (5 items)