--- loncom/auth/lonshibauth.pm 2013/01/04 01:37:02 1.2 +++ loncom/auth/lonshibauth.pm 2015/05/17 17:34:43 1.3 @@ -1,7 +1,7 @@ # The LearningOnline Network # Redirect Shibboleth authentication to designated URL (/adm/sso). # -# $Id: lonshibauth.pm,v 1.2 2013/01/04 01:37:02 raeburn Exp $ +# $Id: lonshibauth.pm,v 1.3 2015/05/17 17:34:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,6 +67,7 @@ package Apache::lonshibauth; use strict; use lib '/home/httpd/lib/perl/'; +use Apache::lonnet; use Apache::Constants qw(:common REDIRECT); use LONCAPA qw(:DEFAULT); @@ -74,7 +75,12 @@ sub handler { my $r = shift; my $target = '/adm/sso'; if (($r->user eq '') && ($r->uri() ne $target)) { - my $dest = &Apache::lonnet::absolute_url($r->hostname()).$target; + my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; + my $hostname = &Apache::lonnet::hostname($lonhost); + if (!$hostname) { $hostname = $r->hostname(); } + my $protocol = $Apache::lonnet::protocol{$lonhost}; + unless ($protocol eq 'https') { $protocol = 'http'; } + my $dest = $protocol.'://'.$hostname.$target; $r->subprocess_env; if ($ENV{'QUERY_STRING'} ne '') { $dest .= '?'.$ENV{'QUERY_STRING'};