--- loncom/auth/lonshibauth.pm 2012/03/05 20:51:29 1.1 +++ 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.1 2012/03/05 20:51:29 raeburn Exp $ +# $Id: lonshibauth.pm,v 1.3 2015/05/17 17:34:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,14 +67,20 @@ package Apache::lonshibauth; use strict; use lib '/home/httpd/lib/perl/'; -use Apache::Constants qw(:common); +use Apache::lonnet; +use Apache::Constants qw(:common REDIRECT); use LONCAPA qw(:DEFAULT); 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'};