This question follows a bit from Question 15632722: "Outbound rules don't apply inside updatepanel".
I have a web application that is being exposed to the public through IIS Application Request Routing as a reverse proxy.
There are several rules that rewrite content on the way out of IIS to "fix" URLs to fit the reverse proxy setup. These rules work well for the application in general except for portions that use an <asp:UpdatePanel>
.
After successfully getting the content for the UpdatePanel to be rewritten as desired, the page containing the UpdatePanel started producing the following javascript error:
Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near [HTML_Specific Details Omitted]
For reference, one of the URL Rewrite rules is:
<rule name="ReverseProxyOutboundRule Data Api - Relative" preCondition="ResponseIsHtml">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script, CustomTags" customTags="Custom" pattern="^/([^/].*)" negate="false" />
<action type="Rewrite" value="/data/{R:1}" />
<conditions>
<add input="{URL}" pattern="^/data/.*" />
</conditions>
</rule>
<preConditions>
<preCondition name="ResponseIsHtml" logicalGrouping="MatchAny">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/[html|plain]" />
</preCondition>
My assumption is that when the response is rewritten, the difference in Content-Length returned is causing the UpdatePanel's javascript to fail when parsing the response and dumping it into the page. Unfortunately, I don't know enough about the internals of how UpdatePanels work to be able to figure out exactly what is going on.
How can I avoid this error?