[Catalyst] Usage of $c->uri_for and $c->res->redirect

Dustin Suchter dsuchter at ucla.edu
Thu Mar 27 06:37:58 GMT 2008


So I like the idea of the plugin, but I'm having a hard time 
installing it. I found one hit on the Internet that with a report of 
someone else having the exact same problem as me, but I don't see 
the solution online:

http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html

Any ideas?

Byron Young wrote:
>> -----Original Message-----
>> From: Dustin Suchter [mailto:dsuchter at ucla.edu]
>> Sent: Wednesday, March 26, 2008 1:13 PM
>> To: The elegant MVC web framework
>> Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect
>>
>> Let's say I want to send people back and forth between an HTTP
>> connection and an HTTPS connection on a server based on some
>> action. For
>> example, clicking on a "logout" button from within my application
>> while
>> connected via HTTPS does something like:
>>
>> $c->res->redirect("http://foo.com/");
>>
>> The above seems like a fine solution except it totally disregards
>> the
>> beauty of uri_for, which I would love to be using for stuff like
>> this.
>> Without uri_for, problems arise when you do things like test via
>> the
>> built in Perl webserver (the one running on port 3000 by default)
>> while
>> on the same webserver as my "production" application.
>>
>> So the real question is, how do I properly refer to my webserver
>> and/or
>> application root and include port or SSL flags? I guess I'm looking
>> for
>> something like $0 within uri_for.
>>
>> -d
> 
> Hey Dustin,
> 
> There's actually a neat plugin for doing this called Catalyst::Plugin::RequireSSL.  You just include it in your plugins and then call $c->require_ssl() at the top of any actions you want to use SSL for.  It will disable itself automatically on the test server, too.
> 
> Cheers,
> Byron
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> 



More information about the Catalyst mailing list