First, you need to enable the Proxy of the pages at /usr/local/lsws/conf/httpd_config.conf and add to the file the following code:

extprocessor cyberpanel {
  type                    proxy
  address                 https://adress.of.the.panel.com:8090
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}

After that, you need in the CyberPanel installation domain to add the following code to the Rewrite Rules, so you don’t need to access CyberPanel via 8090 port any more:

REWRITERULE ^(.*)$ HTTP://cyberpanel/$1 [P]

After that in the mail domain of the desired site add to the Rewrite Rules:

REWRITERULE ^(.*)$ HTTP://cyberpanel/$1 [P]

So the code in the Rewrite Rules should look something like this:

### [PROXY] Snappymail
RewriteEngine On
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^/snappymail
REWRITERULE ^(.*)$ https://cyberpanel/snappymail/$1 [P,L,E=PROXY-HOST:www.example.com]
RewriteCond %{REQUEST_URI} ^/snappymail
REWRITERULE ^(.*)$ https://cyberpanel/$1 [P,L,E=PROXY-HOST:www.example.com]