July 17, 2008
I was using the Coldbox SES interceptor and the built in Coldcourse integration, and ran into a little snag the other day. Our production boxes are clustered behind a load balancer using sticky sessions. In order to, reinitialize the framework, I had to access each host by ip and port.
This causes an issue with the current integration with Coldcourse and the SES interceptor. What happens is your BaseURL gets set to 'http://localhost:1234'. Which is no good for those rewrites, since the address will not resolve.
Use the config or environments.xml to specify a new setting 'BaseHostName'.
<Setting name="BaseHostName" value="mysite.local" />
While you are in the config, make sure you check the order of your interceptors. You will want the environment interceptor to come before the SES. Be sure to set the FireOnInit property to TRUE. This means that the load up of settings occurs once the interceptor get's created and NOT on the execution point.
Then, modify the routes.cfm to accept the new setting.
<cfset setSetting('BaseHostName',cgi.HTTP_HOST) />
<cfif len(getSetting("AppMapping")) lte 1>
<cfset setBaseURL("http://#getSetting('BaseHostName')#/#getSetting('AppMapping')#/index.cfm") />
That's it. Now whether you are clustered or not, you have control over the host name. Maybe this will make it into a future release of Coldbox.