Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Apache reverse proxy for Cockpit KVM

Digital solution partner

Apache reverse proxy for Cockpit KVM

In this article, we will see how to configure a reverse proxy on Apache to access Cockpit via HTTPS, with support for WebSocket. This configuration is useful to improve security and accessibility when using Cockpit on an internal network.

Prerequisites

  • A server with Apache installed and configured to support HTTPS.
  • Cockpit installed on a server with an internal IP address (e.g., 192.168.1.100).
  • Valid SSL certificates for Apache.

Configuring Apache as a Reverse Proxy

Edit the Apache configuration file or create a new virtual host to configure the reverse proxy for Cockpit. The configuration is as follows:

Configuration Explanation

  • ProxyPreserveHost On: preserves the original host name.
  • SSLEngine on and SSLProxyEngine On: enable SSL support for connections between Apache and the client, and between Apache and Cockpit.
  • SSLProtocol and SSLCipherSuite: restrict protocols and cipher suites to enhance security.
  • ProxyPass and ProxyPassReverse manage WebSocket and HTTPS connections between Apache and Cockpit.
  • Support for X-Forwarded headers to inform Cockpit that the connection is via HTTPS.

Restarting Apache

Once the configuration is complete, restart Apache to apply the changes:

Conclusion

This configuration allows secure access to Cockpit through an Apache reverse proxy. Be sure to verify the configuration and check the logs to troubleshoot any TLS handshake or WebSocket connection issues.