Odd URL Rewrite Behavior

126 views
Skip to first unread message

Ben Riordan

unread,
Mar 29, 2012, 3:48:24 PM3/29/12
to ColdFusion on Wheels
Has anyone ever had URL rewrites be completely ignored? For example:

www.website.dev
Route: home
Controller: Home
Action: index

www.website.dev/account/login
Route: home
Controller: Home
Action: index

No matter what page I go to, the route and controller are always the
same. The homepage is loaded. I have nothing fancy going on in my
routes file, just the standard:

<cfset addRoute(name="home", pattern="", controller="home",
action="index")>

I am using IIS7.5 on Windows 7 with the URL Rewirte 2.0 Module and
ColdFusion 9 as well as the web.config downloaded with CFWheels. I
also have the same site set up on a Ubuntu 10.04 server and do not
experience this issue when I copy the site directory over - everything
works as expected on the ubuntu setup.

Thanks,

~ Ben

tpet...@gmail.com

unread,
Mar 29, 2012, 5:50:17 PM3/29/12
to cfwh...@googlegroups.com
do a dump on  application.wheels.routes and post it here so we can see.

Ben Riordan

unread,
Mar 29, 2012, 7:30:11 PM3/29/12
to cfwh...@googlegroups.com
I did a dump and it only included the original home route and 3 blank routes. I really needed to get going so I ditched IIS and used Apache on Windows instead which is working as expected. If I'm feeling curious I'll dig into it more but probably not. My test and production server are Apache anyway so I'll just stick with Apache on Windows. 

Thanks for your response. 

~ Ben

Li, Da

unread,
Apr 9, 2012, 3:40:33 AM4/9/12
to ColdFusion on Wheels
I met the exactly same issue (having same setup with Ben: Win 7 + IIS
7.5 + URL Rewrite 2.0 + Railo 3.3.2 + CFWheels 1.1.7, only that I rely
on IIS redirect)

Lines in my routes:
<cfset addRoute(name="kbMetrics", pattern="kb/metrics",
controller="knova", action="getMetrics")>
<cfset addRoute(name="home", pattern="", controller="home",
action="index")>

Here's the dump of "application.wheels.routes":
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Array
1
Scope Arguments
name 1
string kbMetrics
pattern 2
string kb/metrics
controller 3
string knova
action 4
string getMetrics
VARIABLES 5
string
2
Scope Arguments
name 1
string home
pattern 2
string
controller 3
string home
action 4
string index
VARIABLES 5
string
3
Scope Arguments
name 1
string
pattern 2
string [controller]/[action]/[key]
controller 3
string
action 4
string
VARIABLES 5
string controller,action,key
4
Scope Arguments
name 1
string
pattern 2
string [controller]/[action]
controller 3
string
action 4
string
VARIABLES 5
string controller,action
5
Scope Arguments
name 1
string
pattern 2
string [controller]
controller 3
string
action 4
string index
VARIABLES 5
string controller
~~~~~~~~~~~~~~~~~~~~~

hitting http://localhost/kb/metrics always displays /views/home/
index.cfm (instead of /views/knova/getmetrics.cfm) with the following
debug info:
----------------------------------------------------
Application: C07DDA5181D3362104902513AB3D7C82 [Reload, Run Tests]
Framework: Wheels 1.1.7
CFML Engine: Railo 3.3.2.000
Default Data Source: insight2
Active Environment: Development [Design, Testing, Maintenance,
Production]
URL Rewriting: On
URL Obfuscation: Off
Plugins: None
Route: home
Controller: Home
Action: index
Additional Params: reload = development
Caching Stats: hits: 0, culls: 0, misses: 0
Execution Time: 57ms (action ~24ms, view ~23ms, reload ~20ms,
requestend ~1ms, afterfilters ~1ms)
--------------------------------------------------

Looking forward to any insights!

Thank you!

Risto

unread,
Apr 10, 2012, 12:41:05 PM4/10/12
to cfwh...@googlegroups.com
I've seen this happen when people forget to un-comment url rewrite in .htaccess or enable URL rewriting in web.config.
Not saying it's what's causing your issue, but I have seen it before in the case above.


On Thursday, March 29, 2012 3:48:24 PM UTC-4, Ben Riordan wrote:

Andy Bellenie

unread,
Apr 10, 2012, 12:45:06 PM4/10/12
to cfwh...@googlegroups.com
What happens if you go to www.website.dev/index.cfm/account/login

?



--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/cRnbC8v202YJ.

To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.

Ben Riordan

unread,
Apr 10, 2012, 12:51:42 PM4/10/12
to cfwh...@googlegroups.com
I do not have the site up in IIS anymore - happily using apache now, but I believe on my end it did the same thing, followed the home route. I remember testing to include index.cfm in my URLs. Li could test / confirm from his end...

Li, Da

unread,
Apr 11, 2012, 12:25:04 AM4/11/12
to ColdFusion on Wheels
Here are the findings:

1. Adding /index.cfm/ or /rewrite.cfm/ doesn't change anything. (i.e.
http://localhost/index.cfm/kb/metrics )
The route still sticks to 'Home' instead of 'KB'.

2. Moving the same code base to another machine that has ColdFusion 9
Developer + IIS 7.5 + Rewrite Module 2 + Windows 7, and voila, routes
are correctly picked up !!!!

I really don't hope Railo is the reason that makes routes fail. I
thought that cfwheels was pretty railo-friendly, isn't that correct?

I went to another clean machine, installed Railo 3.3.2 from scratch
(with Tomcat 7) and tested the same code base, still routes aren't
respected.

I also tried different IIS connectors: isapi_redirect-1.2.30.dll that
comes with Railo, and BonCode that is popular, neither helped.

@Risto,
Thanks for the hint. I had completely removed .htaccess before I ran
all the tests, so it couldn't be it in my case.

Thank you!

Li, Da

unread,
Apr 11, 2012, 4:07:48 AM4/11/12
to ColdFusion on Wheels
It seems that Railo always return an empty string for CGI.PATH_INFO.

While this is what happens with ColdFusion 9:

URL PATH_INFO
------------------------------------------------------------------
http://localhost/kb/metrics /kb/metrics
http://localhost/kb/ /kb/
http://localhost/ /

http://localhost/index.cfm/kb/metrics /kb/metrics
http://localhost/index.cfm/kb/ /kb/
http://localhost/index.cfm/ /

Probably that's why ColdFusion 9 works.

Li, Da

unread,
Apr 12, 2012, 1:41:48 AM4/12/12
to cfwh...@googlegroups.com
Got it working at last!

The key step was to instruct BonCode connector (http://tomcatiis.riaforge.org) to pass all requests to tomcat. It can be achieved by using the BonCode installer. When you are asked to choose "Select Handler Mapping (Please select which type of requests should be passed through the connector)":
------------------------------------------
* JSP (pass all Java Server Page requests to tomcat)
* CFM/CFC (pass all ColdFusion or Railo requests to tomcat)
* Servlet (add a wildcard reference and pass all traffic to tomcat)
------------------------------------------
MAKE SURE TO CHECK THE 3rd OPTION (Servlet), OTHERWISE IT WON'T WORK.

Or you can tweak from IIS UI to make the changes. (Instructions can be found inside the connector manual.)

Thank everyone who responded to the thread.

Reply all
Reply to author
Forward
0 new messages