Coldbox SES messing up css/javascript references

Hi,

When I enabled SES (without index.cfm) in the URL all my css and
javascript don't seem to get included in my layout template. Any idea
on the best way to resolve this? Sorry if this has been asked before.

Thanks,

-West

how are you referencing the CSS? Should not be dependent on the
index.cfm tho. view source and see what the path is. if may also help
you to add a basepath to the head of your layout i.e.

<head>
<base href="http://www.domain.com/" />
</head>

What rewrite engine are you using to remove the index.cfm from your
URI string? Are you using a rewrite condition to ensure files are
served as files? If not, your regex rule is most likely rewriting the
assets' true path.

Sparky is right that you must include a base href tag if you use SES urls regardless of the framework you’re using.
In ColdBox you can make it dynamic using the htmlBaseURL like so:

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

Yes, adding the base href tag fixed it thanks, but it seems to
possibly have introduced another. So the url rewriting seems to be
working but when I click on a link now the url changes in my browser,
but the event isn't called,

So in my ColdBox.cfc I have a default event of "app.index", when the
website loads I see this page, all good so far. When I click a link
from this page like my Contact Us link:

<a href="#event.buildLink('app.contact')#>Contact Us</a>

It doesn't redirect the page now that I have enabled SES urls in
coldbox. I turned on coldbox debugging and the coldbox event always
showing "app.index". The url changes and the url rewriting works, but
for some reason the coldbox event doesn't change. I'm using a
routes.cfm file but I don't think I'm using it right, I read the docs
on using routes but I still don't get it all the way.

Any ideas what might be causing the event not to change when I click a
link?? Do I have to include routes for every event in my app?
Considering the link works fine in non ses mode I gather it's related
to me making SES related changes...

Here is my entire routes file:
<cfscript>
  setEnabled(true);
  setUniqueURLS(true);
  if( len(getSetting('AppMapping') ) lte 1){
    setBaseURL("http://#cgi.HTTP_HOST#/index.cfm");
  }
  else{
    setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/
index.cfm");
  }
  addRoute(pattern=":handler/:action?");
</cfscript>

-Westside

Just to add, I've removed the index.cfm portion from my routes file,
still same problem as I've described with the coldbox events not
executing.

This maybe obvious, but are you reinit'ing the application after these
changes?

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

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of West
Sent: Monday, 10 January 2011 7:30 AM
To: ColdBox Platform
Subject: [coldbox:7602] Re: Coldbox SES messing up css/javascript

references

Just to add, I've removed the index.cfm portion from my routes file, still
same problem as I've described with the coldbox events not executing.

> Yes, adding the base href tag fixed it thanks, but it seems to
> possibly have introduced another. So the url rewriting seems to be
> working but when I click on a link now the url changes in my browser,
> but the event isn't called,
>
> So in my ColdBox.cfc I have a default event of "app.index", when the
> website loads I see this page, all good so far. When I click a link
> from this page like my Contact Us link:
>
> <a href="#event.buildLink('app.contact')#>Contact Us</a>
>
> It doesn't redirect the page now that I have enabled SES urls in
> coldbox. I turned on coldbox debugging and the coldbox event always
> showing "app.index". The url changes and the url rewriting works, but
> for some reason the coldbox event doesn't change. I'm using a
> routes.cfm file but I don't think I'm using it right, I read the docs
> on using routes but I still don't get it all the way.
>
> Any ideas what might be causing the event not to change when I click a
> link?? Do I have to include routes for every event in my app?
> Considering the link works fine in non ses mode I gather it's related
> to me making SES related changes...
>
> Here is my entire routes file:
> <cfscript>
> setEnabled(true);
> setUniqueURLS(true);
> if( len(getSetting('AppMapping') ) lte 1){
> setBaseURL("http://#cgi.HTTP_HOST#/index.cfm");
> }
> else{
>
> setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/
> index.cfm");
> }
> addRoute(pattern=":handler/:action?");
> </cfscript>
>
> -Westside
>
>
> > Sparky is right that you must include a base href tag if you use SES
> > urls regardless of the framework you're using.
> > In ColdBox you can make it dynamic using the htmlBaseURL like so:
>
> > <*base href*="#*getSetting*( 'htmlBaseURL' )#" />
>
> > > What rewrite engine are you using to remove the index.cfm from
> > > your URI string? Are you using a rewrite condition to ensure
> > > files are served as files? If not, your regex rule is most likely
> > > rewriting the assets' true path.
>
> > > > how are you referencing the CSS? Should not be dependent on the
> > > > index.cfm tho. view source and see what the path is. if may also
> > > > help you to add a basepath to the head of your layout i.e.
>
> > > > <head>
> > > > <base href="http://www.domain.com/" /> </head>
>
>
> > > > > Hi,
>
> > > > > When I enabled SES (without index.cfm) in the URL all my css
> > > > > and javascript don't seem to get included in my layout
> > > > > template. Any idea on the best way to resolve this? Sorry if

this has

Yes. I've reverted back to having index.cfm in the URL, it's still
using SES, but ideally I could have my URLs not include the
index.cfm.

How are you referencing the css/js files, I am not sure why these are even
using the ColdBox framework to begin with.

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

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of West
Sent: Monday, 10 January 2011 2:44 PM
To: ColdBox Platform
Subject: [coldbox:7604] Re: Coldbox SES messing up css/javascript

references

Yes. I've reverted back to having index.cfm in the URL, it's still using

SES, but

The css/js file references are fine now. I just needed to add the
<base href /> tag as Sparky mentioned in his post.

I'm having a new problem which I mentioned above which may or may not
be related. I should probably just create a separate post

-West

Does http://example.com/index.cfm/app/index work?

You don’t want “/index.cfm” in the baseURL. Omit it from the routes file, reinit and then try http://example.com/app/index.

setEnabled(true); setUniqueURLS(true); if( len(getSetting('AppMapping') ) lte 1){ setBaseURL("http://#cgi.HTTP_ HOST#/index.cfm"); } else{ setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/ index.cfm"); } addRoute(pattern=":handler/:action?");

Jason Durham