我正在尝试使用 Apache 代理 cockpit[1],
它打开登录界面,但是登录后我得到一个空白屏幕,没有错误,什么都没有。在 devtools 中我发现了一个 ws 错误Error during WebSocket handshake: Unexpected response code: 400
cockpit-ws 守护进程在它的日志中输出这个
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
我在 Centos7 上运行 cockpit 195
这里是相关的配置部分
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/
是的,我没有使用我知道的虚拟主机,我试图让它在/cockpit
url 上工作,但这是另一个问题
这是/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