I tried to reverse proxy cockpit without success.
My best result is cockpit without menu like in Accessing Neth Server Cockpit behind a Nginx reverse proxy and cockpit not working anymore on port 9090.
I used this cockpit wiki github page to get the httpd config.
I had no reverse proxy configured in the web UI, just a file /etc/httpd/conf.d/rproxy.conf
with following content:
Header always set X-Frame-Options SAMEORIGIN
<VirtualHost *:443>
ServerName your.domain.org
ProxyPreserveHost On
ProxyRequests Off
# allow for upgrading to websockets
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:9090/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://127.0.0.1:9090/$1 [P,L]
# Proxy to your local cockpit instance
ProxyPass / http://127.0.0.1:9090/
ProxyPassReverse / http://127.0.0.1:9090/
</VirtualHost>
I added the following lines to /etc/cockpit/cockpit.conf
:
[WebService]
Origins = https://your.domain.org http://127.0.0.1:9090
ProtocolHeader = X-Forwarded-Proto
#ForwardedForHeader = X-Forwarded-For
AllowUnencrypted = true
and restarted cockpit and httpd:
systemctl restart httpd cockpit
Maybe you can use it as a starting point…