Using CFAjaxProxy in a Shared Hosting Environment

Date September 10, 2008

As I mentioned in my last post (Drag and Drop Sorting with CFAjaxProxy and Script.aculo.us) I’ve started to use CFAjaxProxy. It’s been very easy to integrate and I had no problems at all on my local machine. However, after posting my work to a live site my AJAX functionality ceased working.

Thanks to Firebug, I was able to track down the issue pretty quickly. The cfajax.js and cfmessage.js libraries were failing to load. These files are located in subfolders under the CFIDE folder.

For those unfamiliar with the CFIDE folder, it contains central and core coldfusion files, custom tags, libraries and the ColdFusion administrator. The reason I wasn’t having the problem locally was because I wasn’t in a shared hosting environment so CFIDE was right where ColdFusion expected it to be.

In a shared hosting environment, however, ColdFusion looks for CFIDE in the root of the current domain. So, rather than looking in the web server root, it looks in the domain root. For example, if the site I’m working on is mysite.com, ColdFusion will look for CIDE in http://www.mysite.com/CFIDE/.

While I could make a virtual directory mapping to the existing CFIDE folder, I didn’t want to expose the ColdFusion Administrator. Instead, I created a new CFIDE folder and copied only the SCRIPTS subfolder into it. I then created a CFIDE virtual directory within the domain which pointed to the new CFIDE folder.

I know many developers have experienced a similar issue with CFFORM, however, that issue can be surmounted with the use of the scriptsrc parameter which isn’t available for CFAjaxProxy.

Admittedly, this solution feels a bit lame, but I’m unaware of any other way around it. If you know of a better way, please leave a comment!

-rG

3 Responses to “Using CFAjaxProxy in a Shared Hosting Environment”

  1. Anthony said:

    CFAJAXIMPORT, although not documented for this tag, will solve your problems

  2. Pedro Martins said:

    On Apache Tomcat I’ve managed to make it work by adding to WEB-INF/cfusion/lib/neo-runtime.xml something like:

    /NAME_OF_THE_WEBAPP/CFIDE/scripts/

  3. Pedro Martins said:

    As the tag signs don’t show up, i’ll replace it for ( )

    (var name=’CFFormScriptSrc’)(string)/NAME_OF_THE_WEBAPP/CFIDE/scripts/(/string)(/var)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>