--- loncom/auth/lonacc.pm 2020/10/06 17:39:04 1.159.2.14 +++ loncom/auth/lonacc.pm 2020/10/23 21:33:46 1.159.2.15 @@ -1,7 +1,7 @@ # The LearningOnline Network # Cookie Based Access Handler # -# $Id: lonacc.pm,v 1.159.2.14 2020/10/06 17:39:04 raeburn Exp $ +# $Id: lonacc.pm,v 1.159.2.15 2020/10/23 21:33:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -563,31 +563,27 @@ sub handler { if ($env{'user.noloadbalance'} eq $r->dir_config('lonHostID')) { $checkexempt = 1; } - unless ($checkexempt) { + unless (($checkexempt) || (($requrl eq '/adm/switchserver') && (!$r->is_initial_req()))) { ($is_balancer,$otherserver) = &Apache::lonnet::check_loadbalancing($env{'user.name'}, $env{'user.domain'}); if ($is_balancer) { - unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) { - # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer) - my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r); - if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) { - $otherserver = $found_server; - } + # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer) + my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r); + if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) { + $otherserver = $found_server; + } + unless ($requrl eq '/adm/switchserver') { + $r->set_handlers('PerlResponseHandler'=> + [\&Apache::switchserver::handler]); } - } - } - if ($is_balancer) { - unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) { - $r->set_handlers('PerlResponseHandler'=> - [\&Apache::switchserver::handler]); if ($otherserver ne '') { $env{'form.otherserver'} = $otherserver; } - } - unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') || - ($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) { - $env{'form.origurl'} = $r->uri; + unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') || + ($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) { + $env{'form.origurl'} = $r->uri; + } } }