Using base href with different domains

We're having some problems with our base href. Here's the setup:

We have several sub domains which all resolve to the same site:
www1.mysite.com
www2.mysite.com
www3.mysite.com

In our environments.xml we have:

<environment name="web1" urls="www1.mysite.com">
  <Setting name="SesBaseURL" value="http://www1.mysite.com/index.cfm" /

</environment>
<environment name="web2" urls="www2.mysite.com">
  <Setting name="SesBaseURL" value="http://www2.mysite.com/index.cfm" /

</environment>
<environment name="web3" urls="www3.mysite.com">
  <Setting name="SesBaseURL" value="http://www3.mysite.com/index.cfm" /

</environment>

In our page headers we have:

<base href="#getSetting('sesBaseURL')#">

The problem is that the sesBaseURL setting gets set to whatever URL
was used to last reinit the framework-- not the current URL being used
to access the site.

Is there a better way to accomplish this or is ColdBox just not meant
to be used in an application which can be accessed by different URLs
at the same time?

Thanks.

~Brad

The environment-interceptor is used for different server environment
settings, e.g. dev,test,live.

Use the request decorator (or create an interceptor) to read
(cgi.server_name) and set SESBaseURLS

Ernst

here's another approach if you'd like
http://tomdeman.com/blog/2008/7/17/Clustered-Environments-and-Coldbox-SES-Interceptor

OK, that seems fair enough. To clarify, only ONE environment at a
time can be used?

I am familiar with how to create an interceptor so that approach seems
pretty straight-forward.
I will dig through the docs for some info on the request decorator.

To be honest though, my actual setup is (not surprisingly) a bit more
complicated than my original example. Each of our environments
actually looks more like this right now:

<environment name="web1" urls="www1.mysite.com">
  <Setting name="Path" value="http://www1.mysite.com" />
  <Setting name="SecurePath" value="https://http://www1.mysite.com" />
  <Setting name="SesBaseURL" value="${Path}/master/index.cfm" />
  <Setting name="SecureSesBaseURL" value="${SecurePath}/master/
index.cfm" />
  <Setting name="FullLayoutPath" value="${Path}/master/layouts" />
  <Setting name="Star12FullPath" value="${Path}/STAR12Members" />
  <Setting name="Star12SecureFullPath" value="${Path}/STAR12Members" />
  <Setting name="Star12ImageFullPath" value="${Path}/STAR12Members/
Images" />
  <Setting name="Star12SessionCheck" value="${Path}/STAR12Members/
MemberServices" />
  <Setting name="JoinStar12Now" value="${Path}/STAR12Members/Checkout/
MemberCheckout.cfm" />
  <Setting name="SesBaseURL" value="${Path}/master/index.cfm" />
  <Setting name="SecureSesBaseURL" value="${SecurePath}/master/
index.cfm" />
</environment>

As you can see, there are actually quite a few paths we have put into
settings (mostly because we expect them to change soon and only want
to have to change them in one place.)

Would I need to set ALL of these in an interceptor or request
decorator? My problem with that is many of these links are also
legitimately different between the environments. I kind of have a two-
fold problem here. I have path differences between servers/domains
that you have told me should be handled by an interceptor/request
decorator and I also have path differences between my environments
which still seem as though I should be using the environment
interceptor to handle.

Also, another item is where I should be setting these paths like my
SESBaseURL. Am I correct that setSetting() will be modifying the
setting for the entire application? It sounds like these need to be
set on a per request level. Should I be finding a way to calculate
all the paths based on environment AND domain and cram all these
settings into the requestContext on every page hit? Perhaps when I
read up on the request decorator things will clear up a bit for me.

~Brad

Thanks for the link. I'm still trying to digest it a bit. I think part
of my problem is I have never taken the time to fully understand what
routes.cfm is and how it affects me.

~Brad

You are right: setSetting is used for entire application....it's a
ColdBox config setting...so set it once (on framework init), use it
everywhere.

If your vars can be different on each request, you should use the
request decorator or interceptor.
Sure, you can create a setting which hold all different server
settings, but you still need request-functionality to get the right
settings (e.g. using a struct key).