Ran into another issue (caused by me) with the IIS URL Rewrite module and ColdFusion.
A couple of our client applications utilize a REST API written in ColdFusion. It does not use the newly released built-in API in Coldfusion 2016. The REST url’s are made possible by using the IIS URL Rewrite module. The module takes the rest API and then passes it to the ColdFusion API handler
Sample:
<action type="Rewrite" url="/api/v1/api.cfm?resource={REQUEST_URI}" />
The custom API handler then parses the URL, FORM variables, and several other HTTP elements to process the request.
I noticed that when calling the API all but the FIRST URL variable was doubled.
Example:
/api/v1/resource?key=SomeUniqueKey&anotherurlvariable=test
In this case the variable anotherurlvariable would come across to ColdFusion with a value of “test,test”.
The solution was pretty simple. I failed to use the URL Rewrite modules URLEncode function to correctly encode the URL (in my case resource) being passed to ColdFusion.
Updated URL Rewrite key (in web.config):
<action type="Rewrite" url="/api/v1/api.cfm?resource={UrlEncode:{REQUEST_URI}}" />
An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.
0 Comments