Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Outbound rule for Google Analytics causes 500.52 error on ColdFusion pages

$
0
0

Using the information here about inserting code via an outbound rule, and also encoding the Google Analytics javascript (because of the "{" character in the GA javascript), the outbound rule will correctly insert the GA code before the body code .

The process works fine for .htm pages on the IIS site with Coldfusion 9 installed, but a .cfm page (same code as htm, but with a cfm extension so ColdFusion processes it), I get a 502 error (returned by the error page processing). (Compression is turned off.)

The infrastructure is through an ARR proxy server (Windows 2008 R2 with ARR/UrlRewrite), which rewrites the request to another server (Windows 2008 R2, with ColdFusion 9.01 and URLRewrite); that second server has the page file and the outbound rule.

So a Failed Request Tracing shows the actual error as 500.52, which I believe indicates  "A rewrite error occurred during RQ_SEND_RESPONSE notification handling. An outbound rule execution occurred."

The "General Reponse Header" in the FRT shows:

Headers="Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.5
X-Powered-By: cf9prod01"

The GA code inside the outbound rule (created via editing the web.config) is this:

<outboundRules><rule name="googleanalytics tracking script" preCondition="IsHTML" enabled="true" patternSyntax="ExactMatch"><match filterByTags="None" pattern="&lt;/body&gt;" /><action type="Rewrite" value="&lt;script type=&quot;text/javascript&quot;&gt;
   var _gaq = _gaq || [];
   _gaq.push([&#39;_setAccount&#39;, &#39;UA-35053227-1&#39;]);
   _gaq.push([&#39;_trackPageview&#39;]);
   (function() {UrlDecode:%7B}
     var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
     ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
     var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
   })();&lt;/script&gt;&lt;/body&gt;" /></rule><preConditions><preCondition name="IsHTML"><add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /></preCondition></preConditions></outboundRules>

So, the question (after hopefully providing enough information): why does the HTML page work with the outbound rule, but the CFM (ColdFusion) page causes the 500.52 error?


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>