--- loncom/lontrans.pm 2018/04/21 20:34:44 1.22 +++ loncom/lontrans.pm 2018/07/26 19:01:25 1.24 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.22 2018/04/21 20:34:44 raeburn Exp $ +# $Id: lontrans.pm,v 1.24 2018/07/26 19:01:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,7 +91,10 @@ sub handler { } } my $host = $r->headers_in->get('Host'); - if ($host) { + if ($r->is_initial_req() || !$host) { + $r->internal_redirect($realuri); + return OK; + } else { my $protocol = 'http'; if ($r->get_server_port == 443) { $protocol = 'https'; @@ -167,16 +170,16 @@ sub redirect_raw { my $remintdom = &Apache::lonnet::internet_dom($remprimary); if (ref($replication->{'certreq'}) eq 'ARRAY') { if (grep(/^\Q$remintdom\E$/,@{$replication->{'certreq'}})) { - $redirect = 1; - } else { $redirect = 0; + } else { + $redirect = 1; } } if (ref($replication->{'nocertreq'}) eq 'ARRAY') { if (grep(/^\Q$remintdom\E$/,@{$replication->{'nocertreq'}})) { - $redirect = 0; - } else { $redirect = 1; + } else { + $redirect = 0; } } } @@ -186,7 +189,7 @@ sub redirect_raw { last; } } - return $redirect; + return $redirect; } 1;