The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

Front Controller Frameworks Suck

posted under category: ColdFusion on March 1, 2010 at 10:00 pm by MrNate

I always hated them for this one reason. How do you explain this URL:

www.example.com/index.cfm?fuseaction=main.default

What I dislike about that is...


Really, it comes down to your users, their experience, and how they see your application. While it's not as important as your usability, design, content or uptime, it does take away from the overall quality.

So what can be done about this problem? Few have tried, some have succeeded. Here are the strategies that are out there.


Can anyone think of another method of doing it?

Personally, I like the OnMissingTemplate method a lot. The distinct advantage above the URL rewriting method is that this one is portable without installing other software. Of course it doesn't work everywhere, but it almost always will.

In summary, make your users happier and write your next application with a better SES strategy.

Too old to comment!
On Mar 2, 2010 at 1:00 AM Andy Bellenie (andybellenie who can't believe it's not gmail.com) said:
I don't see what's difficult about URL rewriting in IIS. Isonic's free ISAPI filter is really good and no more complex than mod_rewrite. We use it over at CFWheels for our IIS based rewriting.

On Mar 2, 2010 at 1:00 AM Raymond Camden (ray at the ever popular camdenfamily.com) said:
I'll ditto Andy, although I use IIRF. I develop on Apache and use the same .htaccess rules on IIS. It works perfectly well. Also, Google Analytics has no problem separating index.cfm?event=1 from index.cfm?event=2. It can use the TITLE tag to recognize them as different pages. Any search engine that can't isn't really doing a good job. I mean, shoot, dynamic web pages have been around forever. The idea of "some file name, different query string" isn't exactly new.

On Mar 2, 2010 at 1:00 AM Steve Bryant (steve at the ever-endearing bryantwebconsulting.com) said:
I agree completely. The framework that we use relies more on page controllers than a front controller and doesn't use hub-and-spoke.

The only place I would disagree is that having .cfm files everywhere prevents the use of a framework.

I'm not sure what you can do with hub-and-spoke that can't easily be done without it.

On Mar 2, 2010 at 1:00 AM Nathan Strutz (http://www.dopefly.com/) said:
Andy, I know that the Ionic ISAPI Rewrite on IIS is touchy and has made my servers unstable, one wrong regex blows the whole server. It's fine once it's running, but don't touch it. If you don't see what's difficult about URL rewriting, maybe you are more of a regex master than most of us.

Ray, I haven't used IIRF, and you're right about Google.

In either case, you're developing software that requires a web server plugin to work in different environments, especially IIS. Cross-platform won't really work.

I just like the OnMissingTemplate method, but that's my preference. It's obvious that URL rewriting is the long-standing champion, and it's obvious that most of us don't use it.

On Mar 2, 2010 at 1:00 AM Raymond Camden (ray who hates camdenfamily.com) said:
"Cross platform won't really work" - but isn't there always going to be differences between Apache and IIS? Ignore URL Rewriting. Even the _setup_ of a virtual server is different. Unless you are writing an app to be dropped into a subfolder, the setup process will necessarily be different. Therefore having a different URL Rewrite setup doesn't seem like an issue to me (as long as you can use the same rules of course).

I think onMissingTemplate is good as well - although it does still require a .cfm in the url, which ain't so bad of course.

On Mar 2, 2010 at 1:00 AM Brian Swartzfager (bcswartz via gmail.com) said:
Two things:

--It looks like most of the current ColdFusion frameworks provide a means of generating SES URLs via the framework itself, without having to worry about whether the web server is IIS, Apache, or "other."

--I can see the value in having SES URLs for a publicly-accessible website designed to attract users, but not if you're building intranet or extranet web applications requiring authentication to access.

On Mar 2, 2010 at 1:00 AM spills (spillsmills, who eats yahoo.com) said:
IIS 7.XX has URL rewriting built in with wizards if you so wish to use. It is even "kinda" Apache MOD Rewrite compatible and I can say the URL rewriting works really well without the overhead of the .dll approach.

On Mar 2, 2010 at 1:00 AM Ben Nadel (ben from bennadel.com) said:
I use IIS MOD-Rewrite, which has been very fast and very stable. It's pretty cheap ($150/server) and is apparently the most Apache-compatible IIS mod rewrite available. But for me, the selling feature was that it allows for very easy per-site rewriting and had a sweet GUI for installation and management.

On Mar 2, 2010 at 1:00 AM Matt Woodward (http://blog.mattwoodward.com) said:
The "problem" you point out doesn't mean front-controller frameworks suck. It just means if you care about the issues you raise that you have to address them somehow.

Simple solution: use Apache and mod_rewrite on both Windows and Linux. Problem solved. And then if you really want to, throw a servlet filter in the mix and eliminate the index.cfm page from the URL too. Gives you a ton more flexibility and seems way less hackish to me than onMissingTemplate.

On Mar 2, 2010 at 1:00 AM Steve Bryant (steve who spends every waking moment visiting bryantwebconsulting.com) said:
Matt,

I took Nathan's "Front Controller Frameworks Suck" to be friendly hyperbole.

The issues do seem to me to be legitimate challenges - costs if you will. That doesn't mean that the benefits of front controller frameworks don't outweigh the costs. Clearly for many they do.

I am curious about how these challenges are solved on shared hosting. That isn't meant as a dig, but as a legitimate curiosity.

On Mar 2, 2010 at 1:00 AM Tony Garcia (http://objectivebias.com) said:
@Steve,
On shared hosting, I've used the built-in SES URL capabilities of the framework (ColdBox in my case) and ISAPI Rewrite (available in Hostek shared hosting plans) to remove the leading "index.cfm/
I've never had a problem w/implementing "pretty" URLS when using a front controller framework either in CF or in PHP

On Mar 2, 2010 at 1:00 AM Steve Bryant (steve@example.com who would have preferred an address at bryantwebconsulting.com) said:
Tony,

That makes sense. I guess I got confused and thought that you had to do that on the web server.

Come to think of it, however, I should have known better. I used a nice utility like that back when I used Fusebox.

Thanks for the clarification.

On Mar 2, 2010 at 1:00 AM Nathan Strutz (http://www.dopefly.com) said:
Steve has my position pretty right, actually I have always been a framework superfan. The shared hosting, and even minimal hosting where you are just not able or likely to touch the web server itself or install any plugins, is what I generally target in my software - the lowest common denominator - that's what you target when you want your software to run everywhere.

I'm expressing a long time issue I've had and have yet to take up on the blog. Yeah "Frameworks Suck" is overselling myself and the subject :)

I put out some open-sourcey apps and I always take a stance against requiring any server configuration or special setup. That's why I like Derby, per-app mappings, Admin API access, and yes, even rolling my own SES URLs.

On Mar 3, 2010 at 1:00 AM Tim LEach (nicklepedde who loves gmail.com) said:
I think you missed a middle man. Why not do this:
example.com/index.cfm/SES_page_name/Another_one?Misc=var&page=2

Where the switch and/or part you want to be seen as important to Search Engines comes after the index.cfm, and it's also not hard to remember/read. Plus you don't quite need to do something as dirt as onMissingTempate. That would be the route I'd go.

On Mar 4, 2010 at 1:00 AM Nathan Strutz (http://www.dopefly.com/) said:
Oh Tim, you're right, I completely forgot the .cfm/argument trick. Doesn't that one require a tweak to your web server or something to make it work? I haven't ever tried it. I do sort of dislike that approach just because it still looks like a meessy address. Thanks for bring this one up!

On Mar 5, 2010 at 1:00 AM James Moberg (james at the ever famous ssmedia.com) said:
When using IIS, only the physical script_name is logged by IIS... so if you use index.cfm/SES_pagename.htm, only "index.cfm" will be logged.

Because of this, we ended up writing our own CFLogging script that records the entire path_info value and not just the script_name.
Too old to comment!