I have added apache directives for proxying. it works perfectly in http vhost but fails in https site. I looked at vhost files and saw that apache directives are written in http vhost but the are not written in vhost-le-ssl. I even resynced all websites. I remember this was working a few days ago. But in the meantime I upgraded ispconfig to latest version
Your issue is not related to ISPConfig. When you have a file vhost-le-ssl, then you must have used certbot command on the shell manually instead of using the SSL function in iSPConfig. This must cause config file inconsistencies. Delete the vhost-le-ssl file that you created manually. Then enable SSL and let's encrypt checkbox in the website settings in ISPConfig instead.
there is no certbot command. I have certbot-auto installed on debian 10 , following this tutorial https://www.howtoforge.com/perfect-server-debian-10-buster-apache-bind-dovecot-ispconfig-3-1/ but it fails to get letsencrypt certificate. so I had to install certificate manually. I have deleted vhost-le-ssl enabled letsencrypt on ispconfig. and it could not get certificate again. But this is working on another server, which is ubuntu 18.04.
Then you know what your issue is. Using certbot manually must break the whole website. Using it on a simple single website LAMP setup without using any control panel is ok, but certbot's capability to edit config files is very limited, so using it on a real hosting server breaks the files. Read the FAQ to find out why Let's encrypt refuses to issue that SSL cert. https://www.howtoforge.com/community/threads/lets-encrypt-error-faq.74179/
I checked "Skip Letsencrypt check", I deleted all vhost-le-ssl files. Now I can enable letsencrypt on all sites. and they are working. I hope, I did not break anything. This is an office server behind router, in a VM, running a few apps. Your help is very much appreaciated.