htmlBaseURL prepends www

I am having an issue with htmlBaseUrl prepending "www" to the URL.

I have a coldbox app setup on a subdomain. beta.site.com in my
ColdBox.cfc I have this

    settings = {
      htmlBaseURL = "http://beta.site.com"
    };

and in my default Layout I have

  <base href="#getSetting('htmlBaseURL')#" />

But when the site runs, in the HTML source code I see this
<base href="http://www.beta.site.com/" />

Because of which - no css/images etc work.

I am sure I am missing something simple - but I cant figure out what?
Any ideas?

I forgot to mention, in my Routes.cfm I have this - in order to remove
the "www"

<cfset setEnabled(true)>
<cfset setUniqueURLs(false)>

<cfif len(getSetting("AppMapping")) lte 1>
  <cfif cgi.http_host contains "local" or cgi.http_host contains "test"
or cgi.http_host contains "beta">
    <cfset setBaseURL("http://
#replacenocase(cgi.HTTP_HOST,"www.","","all")#/index.cfm")>
  <cfelse>
    <cfset setBaseURL("http://
www.#replacenocase(cgi.HTTP_HOST,"www.","","all")#/index.cfm")>
  </cfif>
</cfif>

But in any case - Routes.cfm would only be used by the
event.buildLink() function probably and not by the
getSetting("htmlBaseUrl") .

If I manually hardocde the baseUrl in my layout file to beta.site.com
- then event.buildLink() starts adding "www" to all the links....this
is strange as I thought Routes.cfm and the config file are the only 2
places where I should define this...and it sitll doesnt work as it
should.....this only happens after I moved to M6...not sure if it has
anything to do with that..

If you ask me you haven't reinitialised the application, because it must be
hitting this line in your routes.

<cfset
setBaseURL("http://www.#replacenocase(cgi.HTTP_HOST,"www.","","all")#/index.
cfm")>

Regards,
Andrew Scott
http://www.andyscott.id.au/

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of Anuj Gakhar
Sent: Monday, 16 August 2010 7:21 PM
To: ColdBox Platform
Subject: [coldbox:5277] Re: htmlBaseURL prepends www

If I manually hardocde the baseUrl in my layout file to beta.site.com
- then event.buildLink() starts adding "www" to all the links....this is

strange

as I thought Routes.cfm and the config file are the only 2 places where I
should define this...and it sitll doesnt work as it should.....this only

happens

after I moved to M6...not sure if it has anything to do with that..

> I forgot to mention, in my Routes.cfm I have this - in order to remove
> the "www"
>
> <cfset setEnabled(true)>
> <cfset setUniqueURLs(false)>
>
> <cfif len(getSetting("AppMapping")) lte 1>
> <cfif cgi.http_host contains "local" or cgi.http_host contains

"test"

Damn! I had a reinitPassword setup on Production and I kept on doing index.cfm?fwreinit=1 instead. and it never complained about anything. Just didnt do the reinit.
I now put in the password and it worked instantly.

Thanks for pointing me in the right direction, Andrew :slight_smile: