Multiple domains and BaseURL


This has probably been asked before but i'm unable to find it or
figure it out.

I need to have multiple subdomains pointing to the same application.
Effectively making the BaseURL parameter a session variable and not

Any ideas? I'm probably missing something right in front of me.



Why not use a cgi variable?

My concern is over what CB does in order to resolve the BaseURL

So when using event.buildLink() for example? I'd need it to use the
cgi variable.

My question is what's the best way to accomplish this?

So to explain in a bit clearer fashion:

2 domains


I want the application to handle them both (treat them as the same
site) and use them accordingly everywhere based on the request.

You can look in forgebox we have an interceptor for this.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:


Yes, essentially the interceptor sets the base URL in the event object at the beginning of each request. Then build link automatically uses that. That way the value is set for each request based on the current cgi variable.



Oh great!

Thanks for the replies all :slight_smile:

This interceptor is essentially the same thing that I came up with to solve this issue however now I have an onRequestCapture interceptor which I am using to perform some redirects (want to be as close to the beginning of the request as possible) and the baseUrl has not yet been updated for the request. Is there any particular reason you chose to perform this intercept preProcess instead of onRequestCapture? I just want to make sure I am not going to run into unforeseen issues. Or maybe I am doing my redirects incorrectly. We want the redirects to be as fast as possible (super low latency).