framework-one / fw1

FW/1 - Framework One - is a lightweight, convention over configuration, MVC application framework for ColdFusion / CFML.
http://framework-one.github.io
Other
374 stars 141 forks source link

Alternate action values (enhancement) #524

Closed doodi-v1 closed 3 years ago

doodi-v1 commented 3 years ago

I'm combining apps, a newer FW/1 app and an older FB5 app. Outside sites and bookmarks reference the older site with fuseaction whereas all the newer app uses action. Due to the outside links not in my control, the combined app needs to honor either. Maybe I'm overthinking my solution so I thought I would runit it by here.

I'm planning to change string variables.framework.action into an array. If initialized as a string, make it an array. All output/formatting routines will now use variables.framework.action[0]. All input parsing routings will have structKeyExists() logic added and walk through the array in order.

There are only about a dozen references to variables.framework.action in one.cfc so the change does not seem that bulky or complicated. Is this the route you would suggest or, like I initially stated, am I over thinking the solution?

lramirez925 commented 3 years ago

Assuming you are not using SEO, I would think that you could probably accomplish what you want with apache or whatever web server you have in front of CF with URL rewrites instead of moving the logic into the framework. If they are going to be one to one, aka the differences is only that you use the work action instead of fuse action then the rewrite would be simple.

For proper web standards instead of doing a rewrite, you could respond with redirect / moved. That way any server that tracks can updates its URL instead of continuing to use the old URL. But that isn't always advisable depending on Search engine optimization and other "concerns"

tonyjunkes commented 3 years ago

I agree with @lramirez925. If the old URLs are essentially the same format other than the fuseaction vs action parameters, then this sounds like a job for the web server to rewrite/redirect as opposed to the framework.

While not ideal, you could always intercept the incoming URL path in setupRequest(), identify if it is an old URL (via CGI or URL scope), and redirect to the correct URL as necessary.

doodi-v1 commented 3 years ago

Redirecting is not an option. The clients are API's and my experience is that many client API libraries don't support redirecting and instead simply return the 403 to the calling application for them to handle. My preference would be a setupRequest() like call prior to FW/1 acting on any of the URL or FORM scope variables. If it finds action missing, but fuseaction existing, copy the value to action in the associated scope and continue on as normal.

sneiland commented 3 years ago

This is an extremely unique situation that does not make sense as an enhancement to the framework. There is nothing stopping you from making the changes you suggest for your situation but it does not make sense for the project to support it and maintain it.