Problem with SES and latest Milestone (m6)?

Hi all,

I am trying to use the latest Coldbox Milestone (m6) with a SES url. I use the default application template (the ‘simple’ one) and have included the SES interceptor. I need to remove the index.cfm from the URL also, so I am using the .htaccess file from the download. I use the same setup with an Milestone 4 site, and that works great.

But with the latest version, when I use it without the index.cfm file in the URL, it only shows the default event, no matter what I put in the URL. When I use index.cfm in the url it works likes expected.

Any one else experiencing this behaviour? I know it isn’t Apache, because I use this setup with an earlier version of Coldbox just fine.

How do I get this working?

Kind regards,

Erik-Jan Jaquet

Hi all,

After some debugging, I found what is going wrong here. Not sure if it
is something in the SES Interceptor or in the .htaccess file, so I
thought I would share it with you, to see what you think of it.

My setup is a linux development machine, with Apache, Railo on Resin
and the latest Coldbox milestone.

When I use the SES interceptor with the .htaccess file, it goes wrong
because the interceptors returns a double / in the path_info: //
developer/index/ instead of /developer/index/

When the interceptor loops over this, since the first item is empty it
always goes to the default handler.

My quick fix was to alter the SES interceptor:

  <cffunction name="getCleanedPaths" access="private"
returntype="struct" hint="Get and Clean the path_info and script
names" output="false" >
    <cfscript>
      var items = structnew();

      // Get path_info
      items["pathInfo"] = getCGIElement('path_info');
      items["scriptName"] =
trim(reReplacenocase(getCGIElement('script_name'),"[/\\]index
\.cfm",""));

      // Clean ContextRoots
      if( len(getContextRoot()) ){
        items["pathInfo"] =
replacenocase(items["pathInfo"],getContextRoot(),"");
        items["scriptName"] =
replacenocase(items["scriptName"],getContextRoot(),"");
      }
      // Clean up the path_info from index.cfm and nested pathing
      items["pathInfo"] = trim(reReplacenocase(items["pathInfo"],"[/\
\]index\.cfm",""));
      if( len(items["scriptName"]) ){
        items["pathInfo"] =
replaceNocase(items["pathInfo"],items["scriptName"],'');
      }

      items["pathInfo"] = replacenocase(items["pathInfo"], "//", "/",
"ONCE");

      return items;
    </cfscript>
  </cffunction>

I added the line:
items["pathInfo"] = replacenocase(items["pathInfo"], "//", "/",
"ONCE")
just before the return.

Or do I have to alter the .haccess? What is the best way, is this a
bug in the interceptor, or just some Apache quirk?

Kind regards,

Erik-Jan

Thanks, I will be adding a fix to this, just to be on the safe side…
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Yeah the easy fix is to modify your routes file in the config directory, the
extra / is because of the appMapping I am guessing.

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

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of EJ Jaquet
Sent: Friday, 15 October 2010 12:39 AM
To: ColdBox Platform
Subject: [coldbox:6254] Re: Problem with SES and latest Milestone (m6)?

Hi all,

After some debugging, I found what is going wrong here. Not sure if it is
something in the SES Interceptor or in the .htaccess file, so I thought I

would

share it with you, to see what you think of it.

My setup is a linux development machine, with Apache, Railo on Resin and
the latest Coldbox milestone.

When I use the SES interceptor with the .htaccess file, it goes wrong

because

the interceptors returns a double / in the path_info: // developer/index/
instead of /developer/index/

When the interceptor loops over this, since the first item is empty it

always

goes to the default handler.

My quick fix was to alter the SES interceptor:

  <cffunction name="getCleanedPaths" access="private"
returntype="struct" hint="Get and Clean the path_info and script names"
output="false" >
    <cfscript>
      var items = structnew();

      // Get path_info
      items["pathInfo"] = getCGIElement('path_info');
      items["scriptName"] =
trim(reReplacenocase(getCGIElement('script_name'),"[/\\]index
\.cfm",""));

      // Clean ContextRoots
      if( len(getContextRoot()) ){
        items["pathInfo"] =
replacenocase(items["pathInfo"],getContextRoot(),"");
        items["scriptName"] =
replacenocase(items["scriptName"],getContextRoot(),"");
      }
      // Clean up the path_info from index.cfm and nested
pathing
      items["pathInfo"] =
trim(reReplacenocase(items["pathInfo"],"[/\
\]index\.cfm",""));
      if( len(items["scriptName"]) ){
        items["pathInfo"] =
replaceNocase(items["pathInfo"],items["scriptName"],'');
      }

      items["pathInfo"] =
replacenocase(items["pathInfo"], "//", "/", "ONCE");

      return items;
    </cfscript>
  </cffunction>

I added the line:
items["pathInfo"] = replacenocase(items["pathInfo"], "//", "/",
"ONCE")
just before the return.

Or do I have to alter the .haccess? What is the best way, is this a bug in

the