[cgiapp] C::A::P::Routes

P Kishor punk.kish at gmail.com
Thu Mar 4 10:35:00 EST 2010


On Thu, Mar 4, 2010 at 9:26 AM, Clayton Scott <clayton.scott at gmail.com> wrote:
> On Thu, Mar 4, 2010 at 10:04 AM, Brad Van Sickle <bvansickle3 at gmail.com> wrote:
>> All of that can be done with mod rewrite.  A (sanitized) example of a
>> rewrite/proxy rule I have working in an existing application
>>
>> RewriteRule Runmode/([0-9]+)/([a-zA-Z0-9]+)
>> http://server/perl/instance.pl?rm=Runmode&PARAM1=$1&PARAM2=$2 [P,L]
>>
>> Which takes the URI "Runmode/20/Data" and turns it into
>> "instance.pl?rm=Runmode&PARAM1=20&PARAM2=Data"
>
> I have done and still do the same thing...
>
>> By making use of optional parameters and regular expressions I find it
>> to be very powerful and extremely easy.  The fact that I can use
>> MOD_PROXY in conjuction with this for load balancing, is also awesome.
>> The only downside is that I have to create one of these rules in
>> httpd.conf or in .htaccess for each "pretty" URL, but I don't see a way
>> of getting around.
>
> CAP::Routes/CAP::Dispatch give you the full ability to do what you want
> with regards to regular expressions, but can't handle the MOD_PROXY
> stuff for you.
>
> In that case it makes sense to keep all of your "url definitions" in
> one place: the apache config.
>
>
>> Maybe CGI::Application::Dispatch or CAP::Routes is a better/more
>> powerful way to do this... but I don't see how.  Which is why I'm asking.
>
> I liked using CAP::Routes/CAP::Dispatch because the URLdefinitions were in
> the code that handled them so it was only 1 step to deploy any
> changes: push the code.
> I prefer that to  push the code, update the rewrite rules, restart apache
>


Very good point, esp. when the routes are more than simple or few. Of
course, that still doesn't escape having RewriteRule somewhere, either
in httpd.conf or in .htaccess (shared web servers will only allow
.htaccess). The peril of using Apache is that you have to configure
Apache.


> Clayton
>


>



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the cgiapp mailing list