[Rt-commit] r12732 - in rt/branches/3.8-TESTING: etc
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu May 29 10:29:43 EDT 2008
Author: sunnavy
Date: Thu May 29 10:29:39 2008
New Revision: 12732
Modified:
rt/branches/3.8-TESTING/etc/RT_Config.pm.in
rt/branches/3.8-TESTING/lib/RT/Interface/Web.pm
Log:
added $CanonicalizeRedirectURLs to alter redirect behavior
Modified: rt/branches/3.8-TESTING/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/etc/RT_Config.pm.in (original)
+++ rt/branches/3.8-TESTING/etc/RT_Config.pm.in Thu May 29 10:29:39 2008
@@ -750,6 +750,12 @@
# RT::CustomFieldValues::External. This can be used to pull lists of
# custom field values from external sources at runtime.
+
+# Set $CanonicalizeRedirectURLs to 1 to use $WebURL when redirecting rather
+# than the one we get from %ENV
+
+Set($CanonicalizeRedirectURLs, 1);
+
# }}}
# {{{ Development Mode
Modified: rt/branches/3.8-TESTING/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.8-TESTING/lib/RT/Interface/Web.pm Thu May 29 10:29:39 2008
@@ -184,12 +184,22 @@
# 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 ($uri->host eq $server_uri->host &&
- $uri->port eq $server_uri->port) {
- $uri->host($ENV{'HTTP_HOST'});
- $uri->port($ENV{'SERVER_PORT'});
+ # don't do this if $RT::CanoniaclRedirectURLs is true
+ if ( !RT->Config->Get('CanonicalizeRedirectURLs')
+ && $uri->host eq $server_uri->host
+ && $uri->port eq $server_uri->port )
+ {
+ if ( $ENV{'HTTPS'} eq 'on' ) {
+ $uri->scheme('https');
+ }
+ else {
+ $uri->scheme('http');
}
+ $uri->host( $ENV{'HTTP_HOST'} );
+ $uri->port( $ENV{'SERVER_PORT'} );
+ }
+
$HTML::Mason::Commands::m->redirect($uri->canonical);
$HTML::Mason::Commands::m->abort;
}
More information about the Rt-commit
mailing list