Permalink
Browse files

Fix for ColdFusion 10s changed cgi.path_info

  • Loading branch information...
1 parent 922aeae commit f6a60c4afb6d30ee1df39c225e2c2d8b682b803a @tomespen tomespen committed Jun 8, 2012
Showing with 43 additions and 1 deletion.
  1. +43 −1 requirements/mura/content/contentServer.cfc
@@ -73,7 +73,49 @@ version 2 without this exception. You may, if you choose, apply this exception
<cffunction name="setCGIPath" output="false" returntype="any" access="remote">
<cfset var cgi_path="">
- <cfset var parsed_path_info = cgi.path_info>
+
+ <!---
+ Workaround for the changes to ColdFusion 10 cgi.path_info
+ This relies on IIRF on Windows IIS to have the [U] modifier on the RewriteRules to pass inn a cgi variable.
+ Credit for the discovery and cfscript code belongs to Giancarlo Gomez at http://www.giancarlogomez.com/2012/06/you-are-not-going-crazy-cgipathinfo-is.html
+
+ Implemented and tested on Windows 2008, ColdFusion 10, IIRF 2.1 and MuraCMS 5.6.4938
+
+ Example IIRF.ini config:
+ RewriteEngine On
+
+ #no rewriting for actual files or folders
+ RewriteCond %{REQUEST_FILENAME} -f [OR]
+ RewriteCond %{REQUEST_FILENAME} -d
+ RewriteRule . - [L]
+
+ # redirect ..../myurl to ..../myurl/
+ RewriteRule ^([^/]+)\?(.*)$ $1/ [QSA,L,R=301]
+
+ # rewrite /myurl/ to index.cfm and send /myurl/ in cgi.http_x_....
+ RewriteRule ^(.*)$ /index.cfm%{REQUEST_URI} [L,U]
+ --->
+
+ <cfscript>
+ if (structKeyExists(cgi,"http_x_rewrite_url") && len(cgi.http_x_rewrite_url)) // iis6 1/ IIRF (Ionics Isapi Rewrite Filter)
+ request.path_info = listFirst(cgi.http_x_rewrite_url,'?');
+ else if (structKeyExists(cgi,"http_x_original_url") && len(cgi.http_x_original_url)) // iis7 rewrite default
+ request.path_info = listFirst(cgi.http_x_original_url,"?");
+ else if (structKeyExists(cgi,"request_uri") && len(cgi.request_uri)) // apache default
+ request.path_info = listFirst(cgi.request_uri,'?');
+ else if (structKeyExists(cgi,"redirect_url") && len(cgi.redirect_url)) // apache fallback
+ request.path_info = listFirst(cgi.redirect_url,'?');
+ else // fallback to cgi.path_info
+ request.path_info = cgi.path_info;
+ </cfscript>
+
+ <cfif isDefined("request.path_info") and len(trim(request.path_info))>
+ <cfset var parsed_path_info = request.path_info>
+ <cfelse>
+ <cfset var parsed_path_info = cgi.path_info>
+ </cfif>
+ <!--- End workaround --->
+
<cfif not len(parsed_path_info) and isDefined("url.path")>
<cfset parsed_path_info = url.path>
</cfif>

0 comments on commit f6a60c4

Please sign in to comment.