Caddy V2 how to proxy websoket (v2ray websocket + tls)

I’d like to share my solution to this problem.

(Moderator edit: This is not correct due to improper formatting. See reply below for corrected version. Quote blocks should NOT be used for code for this reason.)

@websockets {
header Connection Upgrade
header Upgrade websocket
}
reverse_proxy @websockets localhost:6001

You only need to configure path for reverse_proxy in v2ray, not in caddy.

2 Likes