• Home
  • More…
  • Archives
  • About…

NUKLEOS weblog

Virtual Memory (Resurrected)

Feeds:
Posts
Comments
« For Old Times’ Sake: PalmOne Tungsten E2
Back To The Past In Apple-Land (Again) »

Don’t Use Directory Name ‘/api’ For Your Own Uses In ColdFusion 11

17/04/2017 by Wouter

Last week, I did loose a lot of time in what should have been a quick ColdFusion hack. My colleagues and I were just trying to set up a web service-based solution for a simple problem: they had a JavaScript page that needed a bit of data for which I already had the code in ColdFusion. So I created a new directory in an existing application, whipped up the required code in ‘index.cfm‘ to return a bit of JSON and tested the result from my browser… only to get an “Error 500 - Application index.cfm could not be found“.

Weird, heh? The required file was there, so why could CF11 not find it? Adding an ‘Application.cfm‘ did not help, neither did repackaging the code in a CFC. On CF8, on the other hand, everything worked as expected. So what was going on?

It took some time, but I did find the explanation: CF11 reserves the directory name ‘api’ for special treatment, so you can’t use it like any other directory name – and of course that was the name I had chosen! Adam Tuttle described the situation nicely in 2015:

Funny you should mention that the issue is inside an /api folder. I’m trying to track down the same problem, except I’m directly accessing an index.cfm (sort of — onRequest intercepts the request and redirects to CFCs as appropriate — it’s a Taffy API) and I’ve found that renaming the folder from /api to … literally anything else… works fine. It’s almost as if something in CF has special meaning at /api, like the special /rest mapping does.

Indeed, renaming my directory solved the problem – too bad it took me so long to find the cause. On to the next problem!

PS. Adam Tuttle has more to say on the subject, but his post on the subject has disappeared: the URL ‘http://fusiongrokker.com/post/coldfusion-11-sometimes-chokes-on-api‘ no longer points to the relevant text, but is redirected to another blog also belonging to Adam Tuttle. There, unfortunately, the post is NOT available. I won’t call this a case of linkrot, but it’s not good either. Luckily, the Wayback Machine has a copy of the page, including a few comments…

Advertisement

Share this:

  • Twitter
  • LinkedIn
  • Email

Like this:

Like Loading...

Related

Posted in ColdFusion, Linkrot!, Software Development, Web Development | 1 Comment

One Response

  1. on 17/04/2017 at 18:12 bradwood

    You can use a directory named /api but you need to go and comment out the Servlet mapping in your server’s web.xml. By default /api/* and /rest/* are mapped to the rest servlet for ColdFusion’s built-in REST functionality.



Comments are closed.

  • April 2017
    M T W T F S S
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    « Mar   May »
  • Android Apple & Macintosh ColdFusion Content Management Design and Art Internet Java Linkrot! Linux Mobile Computing Motorcycles Patents, IP, Privacy and More PDA Personal Photography Python R1100S Science Social Media Society Software Software Development Technology Web Development Wiki

Create a free website or blog at WordPress.com.

WPThemes.


Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • NUKLEOS weblog
    • Join 147 other followers
    • Already have a WordPress.com account? Log in now.
    • NUKLEOS weblog
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

You must be logged in to post a comment.

    %d bloggers like this: