I figured it out . after looking into the log I realized that the redirect link keeps going into snappymail/snappymail which is creating all the problems , the solution was editing the intial redirect to https to add /snappymail , like that .
RewriteRule ^/?(.*) https://%{SERVER_NAME}/snappymail/$1 [R,L]
so when the Proxy is taking the server name it applies snappymail right away hence
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]
this way it works and logs in
hope it helps the others.