--- loncom/lontrans.pm 2016/07/25 19:49:45 1.15 +++ loncom/lontrans.pm 2016/08/16 20:17:54 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.15 2016/07/25 19:49:45 raeburn Exp $ +# $Id: lontrans.pm,v 1.16 2016/08/16 20:17:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,15 +42,12 @@ sub handler { my $host = $r->headers_in->get('Host'); if ($host) { unless ($host =~ /^internal\-/) { - my $c = $r->connection; - if (ref($c)) { - my $remote_ip = $c->remote_ip; - my $lonhost = $r->dir_config('lonHostID'); - if (&redirect_raw($remote_ip,$lonhost)) { - my $location = 'https://internal-'.$host.$r->uri; - $r->headers_out->set(Location => $location); - return REDIRECT; - } + my $remote_ip = $r->get_remote_host(); + my $lonhost = $r->dir_config('lonHostID'); + if (&redirect_raw($remote_ip,$lonhost)) { + my $location = 'https://internal-'.$host.$r->uri; + $r->headers_out->set(Location => $location); + return REDIRECT; } } }