Sub-domains and Coldbox?


I'm using CF 9, IIS 7, and Coldbox 3.5

I'm trying to find out how to setup my site with subdomains.

I have this url for the main site:

On the home page I want to have links like

I'm unclear on a few things:

1. Can I do this just with one IIS website and basically define the
host headers and have them all point to the same IP?

2. Can this be done all within 1 Coldbox application?

Those are my initial questions, but based on the response, I may have
a few more.


If you are intending to run the same application, with the different sub domains then yes you set it up the same way you would any other IIS / Apache with ColdFusion.

However if you are wanting to then point the subdomain to a module, I am not sure if that can be done I asked this same question awhile ago and never got a satisfactory answer that would work.

Ok, that makes sense. I'm not planning on introducing modules at this

I imagine I will have 50+ sub domains though so my next questions are:

1. How would this look from a ColdBox file structure standpoint? Is
there anything that has to be done specifically at the application
level so that one Coldbox app handles multiple sub-domains?

2. I don't want the URL in the address bar to end up being something
like "" or something. I'd like it to be, is there anything I would need to do to
ensure my URLs work this way?

3. If I have multiple sub-domains, are there any issues with
maintaining sessions across them? If a user comes to
and logs in, I'd like them to be able to get to
without re-logging in obviously. I *think* this won't be an issue if
everything is under one Coldbox application with session management
turned on, but I could be wrong.

Maybe I'm making this more complex than it needs to be?

No I don’t think your making it complex at all, there is nothing you need to do on the coldbox side of things. A standard app when IIS / Apache hits the site it will load up and run, and provided that you dont change the application name, then the session will remain the same across all sub domains.

The only thing that I would suggest is using SES, and look into Helicon Mod rewrite if using IIS. But the standard .htaccess file that comes with ColdBox should work without any hitches with SES and sub domains.

So I got SES working, but I'm trying to determine the best way to load
dynamic content based on the sub domain. Once a user clicks:
"" or "" all the content/data
should be pulled based on this. I was thinking of storing the sub
domains in a database table so each one would have some unique ID/PK.
I would then store that unique ID in the session scope, and when I
load data from various tables I could pass this unique ID in as an

What do you think?

Seems like a good approach. Create a preProcess interceptor that can determine the site they are on.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:


Ok, I will look into that Luis... I havne't used interceptors much.
As of now I was doing it "onRequestStart", but is there anything
specifically that interceptors give you? From my limited knowledge
they seem like a way to just intercept the request at a given point.
I'm wondering what would be the gain in general would be when it comes
to using interceptors vs. doing something like this in the
"onRequestStart" method of Application.cfc/Main.cfc