I recently went through a ColdFusion upgrade. We were going from version 8 to version 11. Since we had previously tested the application with ColdFusion 10 we fully expected some hiccups.
Most of the trouble encountered was easy to find and fix, however one item really gave me some trouble.
Our application has a custom API that relies on RESTful URLs. We use the IIS URL Rewrite module to map API RESTful URLs to a ColdFusion API controller page. In previous versions of ColdFusion we’d used the IIS URL Rewrite module without any issues.
When we upgraded to ColdFusion 11 our API no longer functioned and provided very little error detail. Example request:
GET /api/v1/someresource/somekey HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: http4e/5.0.12 Host: mydomain.com
Response for failed API request:
HTTP/1.1 200 OK Content-Length: 0 Server: Microsoft-IIS/8.5 server-error: true X-Powered-By: ASP.NET Date: Wed, 23 Sep 2015 18:27:47 GMT
In a browser this translates to a blank screen (or white screen).
After trying many things to debug the problem (IIS Failed Request Tracing, ISAPI_Redirect logging, etc.) I was no closer to solving the problem.
From what I could gather the request was never actually making it to my API code, but instead died or failed somewhere in the rewrite process.
IIS Failed Request tracing revealed that the request was going through the URL rewrite module correctly, handing off to the ISAPI_Redirect DLL, then to the ColdFusion process as expected. A complete request with no apparent problems, other than no content and the very helpful “server-error: true” header.
I removed the URL rewrite module from the server in order to eliminate it as a problem. I could still test my code using traditional URLs.
Upon trying to access the API via a traditional URL (essentially what the URL Rewrite module would “rewrite” the URL to) I received the same 0 length response. This was my first clue that something was happening at the ColdFusion level.
Finally I was ready to give up and wanted to see if I could find any information about how others may be setting up RESTful URLs with ColdFusion 11.
The search results reminded me that starting in ColdFusion 10; Adobe began offering a built-in RESTful API to allow CFCs to be accessed directly via RESTful URLs. Could it be that the built-in RESTful API was somehow interfering with my custom RESTful API? I’d used this API setup on ColdFusion 10 with no problems, what could be different in ColdFusion 11?
The answer was a NEW mapping that ColdFusion 11 uses by default. Within the ColdFusion 11 web.xml file (Coldfusion 11: %CFUSION%\wwwroot\web.xml) there is a mapping setup for ANY request that has /api in the URL.
Renaming this default mapping resolved my issue. ColdFusion must be reset after editing the web.xml file
An information technology professional with twenty two year's experience in systems administration, computer programming, requirements gathering, customer service, and technical support.