[Rt-devel] RT::Interface::Web::Redirect() broken (for 3.6) in split front/back proxying setup

Jesse Vincent jesse at bestpractical.com
Tue Jun 19 13:57:55 EDT 2007


I've forwarded this to rt-bugs so we can address it for 3.6.5. Thanks

On Jun 19, 2007, at 1:15 PM, Chris Stromsoe wrote:

> On Mon, 18 Jun 2007, Jesse Vincent wrote:
>> On Jun 15, 2007, at 4:20 PM, Chris Stromsoe wrote:
>>
>>> Can the code block be changed to refer to set variables in  
>>> RT_SiteConfig.pm instead of the environment hash?  Or to check  
>>> for something that was set intentionally?  Or to check if the  
>>> redirect should always be to the canonical name?
>> So yeah, I think that a config file flag for "always canonicalize  
>> on redirct" would be a welcome patch for 3.6.5. Is that something  
>> you can whip up?
>
> Nothing fancy, but I've added a call in RT_SiteConfig.pm to:
>
>     Set($CanonicalRedirect, 1);
>
> and then modified Redirect() with a one-liner to this:
>
>     sub Redirect {
>         my $redir_to = shift;
>         untie $HTML::Mason::Commands::session;
>         my $uri = URI->new($redir_to);
>         my $server_uri = URI->new($RT::WebURL);
>
>         # If the user is coming in via a non-canonical
>         # hostname, don't redirect them to the canonical host,
>         # it will just upset them (and invalidate their credentials)
>         if ((!defined $RT::CanonicalRedirect ||  
> $RT::CanonicalRedirect == 0) &&
>             $uri->host  eq $server_uri->host &&
>             $uri->port eq $server_uri->port) {
>                 $uri->host($ENV{'HTTP_HOST'});
>                 $uri->port($ENV{'SERVER_PORT'});
>             }
>
>         $HTML::Mason::Commands::m->redirect($uri->canonical);
>         $HTML::Mason::Commands::m->abort;
>     }
>
>
> That preserves the current behavior by default, only doing a  
> canonical redirect if CanonicalRedirect is set to some non-zero value.
>
>
>
> -Chris
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20070619/7f63eb54/PGP.pgp


More information about the Rt-devel mailing list