Using coldbox 4 in subdirectory

I have an existing site in a hacked-up version of FuseBox. I am doing a slow migration to ColdBox and this is my first CB app ever.

  1. I created “mysite/C” and ran “coldbox create app” from CommandBox.

  2. I copied the coldbox directory (coldbox-4.0.0+00002-201411120022) into /C

  3. I added a mapping to the App.cfc (this.mappings["/coldbox"] = getDirectoryFromPath(getCurrentTemplatePath()) & ‘/coldbox’:wink: and verified it was running from this directory via a cfdump.

  4. Changed the app mapping: COLDBOX_APP_MAPPING = “/C”;

  5. Changed the ColdBox call (new coldbox.system.Coldbox to new coldbox.system.Bootstrap)
    This is all I did.

But it wants to include my root index.cfm for some reason (/index.cfm). It’s not extended my root App.cfc either.

If I put an abort in /index.cfc, it looks like it picks up the main.cfm layout file, then tries to insert /index.cfm when renderView() is called.

Is there something I need to be changing? Perhaps a bug with v4?

Thanks in advance.
Chris

I just downloaded the bundle from coldbox.org/download and used the “SuperSimple” template in my “/C” directory and it works fine. Haven’t figured out what was causing that issue yet. But something to look at when using “coldbox create app” in CommandBox though.

Chris

The difference is in SuperSimple vs. Simple. Looks like CommandBox installs the “simple” version. SuperSimple is the one that works for me.

Chris

I was able to narrow it down even further. Seems to have to do with SES - I guess that makes sense since it would be a general config usually basic upon a root layout.

Coldbox.cfc: interceptors = [{class=“coldbox.system.interceptors.SES”, properties={}}];

If I take that out it works just fine. So I’m going to leave it at that.

Chris

Hmm, that doesn’t seem like it should be an issue at all. And just to clarify, the problem you’re experiencing is that the index.cfm in your web root is being executed along with every ColdBox request inside of a sub folder?

  • Please put a in your root index.cfm and report back with the stack trace. That will tell us what files are getting run and in what order that are including the index.cfm.
  • Also, please confirm what URL you are hitting.
    Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

  • Correct - index.cfm is in the web root
  • I put a cfthrow in there, but I’m not sure yet how to manipulate ColdBox to show me the stack trace instead of the pretty error.
  • URL: http://localhost/C/?fwreinit=1

This is running on Windows 7, IIS with ColdFusion 9.0.1.

Steps taken in a brand new directory:

  1. Run CommandBox CLI
  2. Change to c:\inetpub\wwwroot\mysite\www\C
  3. “coldbox create app”
  4. install ColdBox-be
  5. Edit \C\Application.cfc and add:
    5a. this.mappings["/coldbox"] = getDirectoryFromPath(getCurrentTemplatePath()) & ‘/coldbox’;
    5b. COLDBOX_APP_MAPPING = “/C”;

The above can be duplicated by installing the packages as I described previous. Guessing the SES interceptor isn’t playing nice with IIS - just a guess.

The error you get is:

Type: HandlerService.EventHandlerNotRegisteredException
Messages: The event: index is not valid registered event.

If you add /index.cfm it will run whatever is in there like an abort or throw.

Chris

Yeah, I think we could improve the messaging on the public error template to be a bit more specific. All you need to do is add/edit your coldbox.customErrorTemplate setting in /config/ColdBox.cfc to point to /coldbox/system/includes/BugReport.cfm and reinit the framework Then you’ll see the full error.

Ideally, don’t do this in the main configure method, but instead set up environment detection and override it in a development method so your production site is still more secure. The idea is that you’ll create your own custom error template that has your site’s look and feel that divulges no information on production.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com