0

I'm trying to proxy cockpit[1] with Apache,

It opens the login interface, but when after login I get a blank screen, no errors, nothing. In devtools I found an ws error Error during WebSocket handshake: Unexpected response code: 400

The cockpit-ws daemon output this in its logs

cockpit-ws[14523]: received invalid or missing Upgrade header: (null)
cockpit-ws[14523]: Received invalid handshake request from the client
cockpit-ws[14523]: WebSocket from 192.168.123.2 for session closed

I'm running on Centos7 with cockpit 195

Here is the relevant configuration part

ProxyPreserveHost On                                     
ProxyRequests Off                                        

# allow for upgrading to websockets                      
RewriteEngine On                                         
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]             
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]            
RewriteRule .* ws://192.168.123.2:9090/%{REQUEST_URI} [P]

# Proxy to your local cockpit instance                   
ProxyPass / http://192.168.123.2:9090/                   
ProxyPassReverse / http://192.168.123.2:9090/            

Yeah I'm not using virtual host I know, I'm trying to get this working at /cockpit url, but this another question

Here is /etc/cockpit/cockpit.conf

[WebService]                                                                                         
Origins = https://192.168.123.2:9090 wss://192.168.123.2:9090 http://192.168.123.2 ws://192.168.123.2
ProtocolHeader = X-Forwarded-Proto                                                                   
AllowUnencrypted = true                                                                              

[1] https://cockpit-project.org/

geckos
  • 5,687
  • 1
  • 41
  • 53

1 Answers1

0

Had the same issue, I forgot to enable proxy_wstunnel module.

sudo a2enmod proxy proxy_wstunnel proxy_http ssl rewrite

whole Apache proxy setup is described here https://github.com/cockpit-project/cockpit/wiki/Proxying-Cockpit-over-Apache-with-LetsEncrypt

majso
  • 1
  • 2