$c->uri_for pulls it's base path from $c->req->base. Quoting the documentation in the code:<br>If your application was queried with the URI<br>C<<a href="http://localhost:3000/some/path">http://localhost:3000/some/path</a>> then C<base> is C<<a href="http://localhost:3000/">http://localhost:3000/</a>>.<br>
<br>So, setting $c->req->base to your new base would do the trick for you I think.<br>You would just do $c->req->base('<a href="http://www.mysite.tld:443'">http://www.mysite.tld:443'</a>)<br><br>I'm sure they're are other ways to do this too.<br>
<br><br><div class="gmail_quote">On Wed, Mar 26, 2008 at 4:31 PM, Dustin Suchter <<a href="mailto:dsuchter@ucla.edu" target="_blank">dsuchter@ucla.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Can you directly control the port you redirect to? Part of my<br>
problem is having consistency between the production and test<br>
environments, which operate on 80/443 and 3000/3000 respectively.<br>
<font color="#888888"><br>
-d<br>
</font><div><div></div><div><br>
Ashley wrote:<br>
> There are two approaches which have helped me. Remember the URI object<br>
> underneath can be your friend.<br>
><br>
> 1) Keep things relative.<br>
> $c->uri_for("/blah")->path<br>
> $c->uri_for("/blah")->path_query<br>
><br>
> 2) Change the scheme yourself.<br>
> my $uri = $c->uri_for("/blah");<br>
> $uri->scheme( $my_test ? "http" : "https" );<br>
><br>
> -Ashley<br>
><br>
> On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:<br>
><br>
>> Let's say I want to send people back and forth between an HTTP<br>
>> connection and an HTTPS connection on a server based on some action.<br>
>> For example, clicking on a "logout" button from within my application<br>
>> while connected via HTTPS does something like:<br>
>><br>
>> $c->res->redirect("<a href="http://foo.com/" target="_blank">http://foo.com/</a>");<br>
>><br>
>> The above seems like a fine solution except it totally disregards the<br>
>> beauty of uri_for, which I would love to be using for stuff like this.<br>
>> Without uri_for, problems arise when you do things like test via the<br>
>> built in Perl webserver (the one running on port 3000 by default)<br>
>> while on the same webserver as my "production" application.<br>
>><br>
>> So the real question is, how do I properly refer to my webserver<br>
>> and/or application root and include port or SSL flags? I guess I'm<br>
>> looking for something like $0 within uri_for.<br>
>><br>
>> -d<br>
>><br>
>> _______________________________________________<br>
>> List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
>> Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
>> Searchable archive:<br>
>> <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
>> Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
><br>
><br>
> _______________________________________________<br>
> List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
> Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
> Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
> Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
><br>
<br>
_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>do() || do_not(); // try()<br>--------------------------------<br>Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam<br>--------------------------------<br>
<a href="http://www.kylehultman.com" target="_blank">http://www.kylehultman.com</a>