diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm index 3660ebe34..64be68557 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -55,6 +55,20 @@ sub handler { } my $res = $self->Lemonldap::NG::Common::PSGI::Router::handler($req); + # Avoid permanent loop 'Portal <-> _url' if pdata cookie is not removed + my $url64 = encode_base64( $req->userData->{_url}, '' ); + if ( $url64 + and !$req->pdata->{keepPdata} + and $req->userData->{_session_id} + and ( $req->{env}->{HTTP_COOKIE} =~ /$url64/ ) ) + + { + $self->logger->debug("Force cleaning pdata"); + $self->logger->warning("pdata cookie domain must be set") + unless ( $self->conf->{pdataDomain} ); + $req->pdata( {} ); + } + # Save pdata if ( $sp or %{ $req->pdata } ) { my %v = (