Problems with buildLink() dropping index.cfm

Hi, All:

I've been pulling my hair out (and I didn't have much to start with)
over a problem I've got with the event.buildLink() function.

Often times, it works fine, whereby the code of
event.buildLink("main.index") properly returns the URL of

However, it has started recently to sometimes return, using the above
code, the URL of http://server_name/main/index. This is a problem as I
do not currently have Apache mod_rewrite enabled, so I'm getting 404

The routes.cfm file is "stock" with setEnabled=true and
setUniqueUrls=false. The only pattern is the standard :handler/:action

What is perplexing is that it everything worked fine until yesterday
afternoon, then this problem started occurring. The only change made
to my code was adding dependency injection via the <cfproperty
inject="model"...> tag.

Any help, and the sooner the better, would be appreciated!


Kevin S. Anderson
Superlative Solutions, Inc.

Can you post your routes.cfm file here please.


The routes.cfm file is the "stock" version, but it appears below

  // General Properties
  // Base URL
  if( len(getSetting('AppMapping') ) lte 1){
  // Add Module Routing Here
  // Your Application Routes



---[Original Message]----------------------------------------------
Can you post your routes.cfm file here please.

What do you have for your html base url?

htmlBaseURL = http://localhost/
sesBaseURL = http://localhost/index.cfm

On the buildLink() not including index.cfm (sometimes) in the
generated URL, I have a little more information.

This problem happens if I do a FORM post. In the form, I am using the
buildLink() for the ACTION, and it posts fine. However, once the form
posts, the buildLink() starts acting like I am using full SES URLs,
dropping the baseURL from any generated links. Very wierd.

As much as I hate to do it, I'm about to stop using buildLink() until
I can find out why this is happening.

Just for background, I have just recreated my ENTIRE application,
using the CF9 templates. I am running Apache 2.2, with CF 9 on Windows
7 Pro. I have not enabled mod_rewrite, simply as the final production
system will be running IIS6 or 7.

I've appreciated everybody's input thus far. Thanks for the help, and
hopefully, solution will be forthcoming. Sorry for the newbie


Kevin Anderson
Superlative Solutions, Inc.

Since I'm having so much fun doing posts to this board, here is some
more of what I've found. I could be wrong (it has happened once or
twice before), but running the debugger, I am seeing unreliability in
the coldbox.system.web.context.RequestContext object, specifically
with the getSESBaseURL() method.

In the debugger, the getSESBaseURL() method, which simply returns
INSTANCE.sesBaseURL, it is correct with the value of "http://localhost/
index.cfm". However, subsequent invocations, the INSTANCE.sesBaseURL
is blank, and is returned.

FOR NOW, I have updated the
coldbox.system.web.context.RequestContext::getSESBaseURL to the

<cffunction name="getSESBaseURL" access="public" output="false"
returntype="string" hint="Get the ses base URL for this request">
  <!---<cfreturn instance.sesBaseURL/>--->
  <cfreturn "http://#cgi.server_name#/index.cfm" />

This has solved my immediately problem, and system is working fine,
however, I think there is definitely a bug. I'm concerned with regard
to other problems cropping up that may be related, as the INSTANCE
scope in this component does not seem to be getting populated

Any direction much appreciated, but I'm back to work again.



If you can, I’d take one of the coldbox application templates and try to replicate this behavior with as simple a use case as possible.

If you can’t replicate it, then it’s something about your app. If you can replicate it, then maybe it’s a bug but at at least you’d be able to zip those files up and share so people can see what’s going on.

Unless it’s happened to someone else or there are clear steps to reproduce, it’s difficult to diagnose.

  • Gabriel

Somewhat final update on this issue, along with other I have
experienced. A small disclaimer, however, is in order.

I really like the theory behind the Coldbox technology. Very
impressive and I'm excited to use it to its full potential. The
development and documentation is top notch and my experience is not
intended to detract in any way from the superior job that has been

The above being said, a couple of points I'd like to make:

1. I'm a newbie to CB, and I realize that could be part of the issue
(although I've been a CF developer since it first released).

2. The _code_ referenced by Dorioo is brand new, very small at current
time, and does not do anything fancy (yet).

3. I downgraded to CB 2.6, tweaked the code (replacing *inject* with
*model*, etc.) and EVERYTHING is working PERFECTLY. Excellent
performance and all operations are working.

In light of the above, I am somewhat suspicious that there are either
(a) some problems with 3.0 M6, or (b) my code is the problem. I don't
know which, but I simply don't have the time right now to fully debug
and diagnose. Sorry :frowning:

In any event, I am pressing on, albiet with 2.6, but pressing on none-
the-less! :slight_smile:


Kevin Anderson
Superlative Solutions, Inc.