我想将我的SocketIO客户端与后端连接起来。但是,如果我使用我的卡迪文件,连接就会失败:
Caddyfile:
www.XXX.XXX:443 {
tls XXX.XXX@XXX.de
root * /srv
route {
reverse_proxy /api* api-server:8443
try_files {path} {path}/ /index.html
file_server
}
}客户端:
socketRef.current = io.connect("https://www.XXX.XXX/api", {
rejectUnauthorized: false,
transports: ["websocket"],
});发布于 2022-07-01 11:56:33
https://socket.io/docs/v4/reverse-proxy/#caddy-2
试一试
handle /path/* {
uri strip_prefix /path
rewrite * /socket.io{path}
reverse_proxy localhost:6969 {
header_up Host {host}
header_up X-Real-IP {remote}
}
}https://stackoverflow.com/questions/71380794
复制相似问题