Cockpit works on a web socket combined with http/https interface, Web Socket is used to deliver active content back and forth between client and server. But when a proxy sits in between, it needs to be configured likely.
Set up Apache Virtual Host
Install Apache web server with the following command:
sudo apt install apache2