[Coldbox 4.0.0+00002] routes not initializing

Does anyone know what might cause routes to not initialize on app start? This only really affects us on dev but if an app sits inactive long enough for app to timeout (2 days based on server default) then when going to app url the seo friendly routes are not built (after hitting homepage). If I then fwreinit all is well. Ideas?

Irvin, I’ve never heard of this before. Can you share the error message that you get? Also, note there is a 4.1 update to ColdBox too though I’m not aware of any changes or fixes to routing in it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

There’s no error message really. If the app times out and we go to the home page and then hover over some of the links built via event.buildlink() they’re not built out properly. Likewise if we try going directly to an seo friendly event url it won’t build and just basically says invalid event or whatever. If I reinit the app with fwreinit all is well. I apologize I don’t have better examples. I won’t be working on the app over the weekend so I can likely give concrete examples on Monday.

Thank you!

Hmm, that’s a ball of very unspecific things :slight_smile:

Firstly, buildlink does not use your routes at all, nor is it dependant on the SES interceptor. You’ll need to let me know exactly what you mean when you say the links “are not build out properly”. Please provide what you expected and what you received.

Secondly, the “invalid event or whatever” is an error. Please provide exactly the URL you’ve hit, what route you’re expecting to process, and the exact error you received.

On Monday, of course :slight_smile:

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

It’s a lot later than “next Monday” but it did it again. To repeat, the SES URLs are not building. I know if I manually reinit the app they will. Before I do that here’s the specifics.

Code on page: JOB SEARCH

handler’s prc.xe_ViewJobs value: prc.xe_ViewJobs = “jobs”;

relevant route in routes.cfm: addRoute(pattern="/jobs", handler=“job”, action=“list”);

Value actually created on page: https://jobs (it should be https://dev.psu.jobs/jobs)

When I manually reinit (I haven’t yet but it will fix itself when I do) the value on page will be proper: https://dev.psu.jobs/jobs

To recap it seems if the app is left idle a while it quits building the links. No idea why. A manual reinit “fixes” it. The live public version of this site is https://psu.jobs . We never have this issue on the live site but of course it never sits idle like dev does.

Hmm, that is an interesting behavior that I can’t say I’ve ever seen. Looking at the code in the buildLink method, there are 4 “return” statements and the one that looks like you might be hitting is:

return sesBaseURL & arguments.linkto;

That could return https://jobs if the SES base URL was just “https://

Can you think of any code in your application that’s setting the base SES URL? It defaults to the base URL you set in your /config/routes.cfm file, but it’s also common to use an interceptor to reset it on every request.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

The only place setBaseURL appears other than in the Coldbox ses.cfc itself is in routes.cfm and it’s like…

// Base URL
if( cgi.https is “on” ){
if( len(getSetting(‘AppMapping’) ) lte 1 ){
setBaseURL(“https://#cgi.HTTP_HOST#/”);
}else{
setBaseURL(“https://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/”);
}
}else{
if( len(getSetting(‘AppMapping’) ) lte 1 ){
setBaseURL(“http://#cgi.HTTP_HOST#/”);
}else{
setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/”);
}
}

I don’t need the if https stuff but shouldn’t make any difference. If I dump cgi I see -
cgi.https = “on”
cgi.HTTP_HOST = “dev.psu.jobs

I haven’t manual reinit yet so the built-out links are still as before (i.e. broken). cgi.http_host is simply not included in the built url.