The actual web servers run on LXD containers, while the host Apache2 simply forwards http traffic to the containers. The setup is simple on the host, everything else is default:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://lxd.container.ip/
ProxyPassReverse / http://lxd.container.ip/
</VirtualHost>
For whatever reason, the website loads very slowly on graphic browsers and when it finally loads, it only renders plain html. On text browsers the website finishes loading almost instantly. If the proxy is set through LXD as a device via
lxc config device add mycontainer http proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80
the website behaves correctly, but this method doesn't allow me to share one public IP for all sites on the same port. I also need to isolate the server for each site on separate containers, so I cannot just put them in different document roots.