Freeshell HTTP Proxy 支持 WebSocket 的反向代理了,只需在控制面板中启用 WebSocket,如下图所示:

启用 WebSocket 后,正常的 HTTP(S) 反向代理仍然能使用。但 freeshell 内的 Web 服务器必须支持 HTTP/1.1 版本(绝大多数 Web 服务器都支持的),HTTP/1.0 将不能工作。

事实上昨天晚上 freeshell 就已经上线了这个功能,但由于配置错误不能工作。今天发现,问题是 proxy_set_header Upgradeproxy_set_header Connection 写在了 location / 外面。我本来指望 location 里会把里面和外面的配置 “合并” 起来,但事实上里面的配置会覆盖掉外面的配置,如官方文档所述:

These directives are inherited from the previous level if and only if there are no proxy_set_header directives defined on the current level.

感谢 Zihao Wang 的建议。

Merry Christmas!