MCSManager / MCSManager

Free, Secure, Distributed, Modern Control Panel for Minecraft and most Steam Game Servers.

Home Page:https://mcsmanager.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于Caddy的反向代理

panda2134 opened this issue · comments

不知道写这里合不合适,但是这里面有个大坑

大家看到 nginx 和 apache 的反向代理就可能会想到要单独配置 websocket 代理,像这样:
(注意这个是错的!)

example.site {
  proxy / 127.0.0.1:23333 transparent
  proxy /websocket/ws ws://127.0.0.1:23333/websocket/ws websocket
}

但是这个根本用不了。可能是caddy有bug,这么写并不会dial本地的websocket,而是会dial一个奇怪的地址(像我这是64.70.19.33:80),导致 502.
经过几个小时的踩坑,我发现必须要把两个条目写在一起! e.g.

example.site {
  proxy / 127.0.0.1:23333 transparent websocket
}

这样就可以用了
@Suwings 不知道能不能加到README.md的反向代理设置教程里面

已添加,有其他情况也可以继续在此 issue 讨论。