Friday, June 01, 2012

You are not going crazy CGI.PATH_INFO is empty in ColdFusion 10

Well I think the subject says it all. Today I upgraded my development and new production server to ColdFusion 10 and to my surprise a variable I was relying on to manage my routing is being passed empty on all requests. After a little googling I stumbled upon this page over at RIA Forge which stated this.

RIA Forge Page

Now I didn't just want to rely on that alone so I decided to do a test on all 3 servers I have, 8, 9 and 10 with the same page showing the same information (ColdFusion Version Number, CGI.PATH_INFO and CGI.SCRIPT_NAME)

Windows 2003, IIS 6, ColdFusion 8

Windows 2003, IIS 6, ColdFusion 9

Windows 2008 R2, IIS 7.5, ColdFusion 10

As you can see the third one does not show the cgi.path_info variable. So stop pulling your hair out and thinking it is more than just what it is. Apparently from IIS7 to Tomcat this just does not get passed. But I decided to do one more test on my Mac and it appears it is not only IIS7 but Apache is also affected and this variable is not being passed. So if you really need this and you are going to 10 lets hope the Tomcat team does something to remedy soon or come up with a different solution. Remember there is always more than 1 way to skin a cat.

Mac, Apache, ColdFusion 10

Code Example

Below is what I did to work with this issue in a current project. Since several developers using different platforms are on this single project I wrote it with that in mind. Basically save the final variable output into the request scope in case I need it anywhere else thru the request. This is set on the onRequestStart function of my APplication.cfc


This is an output of what I use to get from CF9 using cgi.path_info, check out the URL and the output.

BTW * the domain used is not a real one, this is a local url I defined in my host file, in case anyone tries to go to it :). actually belongs to someone else.

Post a Comment