7

I just installed ColdFusion 2016 (upgraded from CF10) and I noticed that whenever I try and access a folder in my webroot called 'api', I get an internal 500 error.

For example: www.mysite.com/api/

I assume this has something to do with the new ColdFusion API REST service so I created another directory called 'rest', performed the same test (www.mysite.com/rest/), and received yet another 500 error.

See the IIS error screenshot: enter image description here

The strange thing is that I don't use the ColdFusion REST service and I don't have it enabled in ColdFusion Administrator.

My Question:

Are you allowed to have folder names in your web root named "api" or "rest" anymore? Or are these now reserved folder names? Is there a workaround to disable this feature for a specific site so I can use these folder names?

Dave L
  • 3,095
  • 3
  • 16
  • 25

1 Answers1

14

Saw this on the Adobe Forums which should answer your question:

The reason you can't access /api/ or /rest/ is because there is a cf servlet-mapping for those folders.

You can remove the mapping by going to cfinstall/cfusion/wwwroot/WEB-INF/web.xml. Search for the api servlet-mapping and comment it out.

There doesn't seem to be a way to do this for a specific site other than using IIS rewrite to redirect traffic to another folder. Something like this should work (redirects traffic from /api/ to /api2/):

<rule name="Redirect" stopProcessing="true">
     <match url="^api$|^api/(.*)" />
     <action type="Rewrite" url="api2/{R:1}" appendQueryString="true" />
</rule>

if anyone knows a way to disable this for a specific site without modifying web.config please feel free to share your ideas.

Hen
  • 176
  • 1
  • 4
  • 1
    This is crazy! It was driving me nuts for a couple hours, and I could not find it anywhere. Thank you. Its also important to note that this STILL exists in CF 2018. Even with the "rest" and "api" stuff turned off in CFIDE this is still an issue. I did try to edit the `/cfusion/wwwroot/WEB-INF/web.xml` file without any success. I only managed to break the instance of CF. – Keith E. Truesdell Mar 19 '21 at 13:28