Caddy配置升级1 to 2
本文最后更新于 1447 天前,其中的信息可能已经有所发展或是发生改变。

Screenshot_20201205_170333.png

proxy
The v2 equivalent is reverse_proxy.

Notable subdirective changes are header_upstream and header_downstream
have become header_up and header_down, respectively; and
load-balancing-related subdirectives are prefixed with lb_.

One other significant difference is that the v2 proxy passes all
incoming headers thru by default (including the Host header) and sets
the X-Forwarded-For header. In other words, v1’s “transparent” mode is
basically the default in v2 (but if you need other headers like
X-Real-IP you have to set those yourself). You can still
override/customize the Host header using the header_up subdirective.

Websocket proxying “just works” in v2; there is no need to “enable”
websockets like in v1.

The without subdirective has been removed because rewrite hacks are no
longer necessary in v2 thanks to improved matcher support.
根据以上提示可以将

mydomain.me
{
  proxy /ray localhost:10000 {
    websocket
    header_upstream -Origin
  }
}

转化为

mydomain.me
{
  reverse_proxy /ray localhost:10000
}

非常简短

上一篇
下一篇