V2ray-core: Websocket不套CDN能正常使用,但是套了CDN就不行了

Created on 28 Mar 2018  ·  14Comments  ·  Source: v2ray/v2ray-core

我用的是Cloudflare,确实开了Websockets,但开了CDN就用不了
中文:

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
均为最新
2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。
扶墙
3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等)
Handshake failed
4) 你期待看到的正确表现是怎样的?
正常使用
5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:
    {
      "log" : {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
      },
      "inbound": {
        "port": 端口, 
        "protocol": "vmess",
        "settings": {
          "clients": [
                  { "id": "某某" },
                  { "id": "某某", "alterId": 64 },
                  { "id": "某某", "alterId": 64 }
          ],
          "disableInsecureEncryption": true
        }
      },
        "streamSettings": {
          "network": "ws",
          "security": "none"
          },
      "outbound": {
        "protocol": "freedom",
        "settings": {}
      }
    }
客户端配置:
{
  "dns":{
    "servers":[ 
        "4.2.2.1",
        "4.2.2.2"
    ]
  },
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1080,  
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "udp":true 
    }
  },
    "streamSettings": {
      "network": "ws",
      "security": "tls" // 这儿也试过none,不过呢,还是不行
    },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [{
        "address": "地址", 
        "port": 端口,  
        "users": [{ "id": "某某","security":"aes-128-gcm" }]
      }]
    }
  },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
      {
        "type": "field",
        "domain": [
          "geosite:cn"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "ip": [
          "geoip:private",
          "geoip:cn"
        ],
        "outboundTag": "direct"
      }
    ]
    }
  }
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:
    // 在这里附上服务器端日志
无
客户端错误日志:
    // 在这里附上客户端日志
2018/03/28 14:52:07 [Warning] App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [dial tcp 104.18.56.5:端口: operation was canceled dial tcp: operation was canceled] > Retry: all retry attempts failed

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

    // 在这里附上服务器端日志

8) 其它相关的配置文件(如 Nginx)和相关日志。

请预览一下你填的内容再提交。

Most helpful comment

服务端

{
  "log" : {
    "access": "/root/v2ray/access.log",
    "error": "/root/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 11443,
    "listen": "127.0.0.1",
    "protocol": "vmess",
    "allocate": {
        "strategy": "always"
    },
    "settings": {
      "udp": true,
      "clients": [
        {
          "id": "c***********51",
          "level": 1,
          "alterId": 10,
          "mail": "*********m"
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "auto",
      "wsSettings": {
        "path": "/ws"
      }
    }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    }
  }
}

客户端

{
  "log": {
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1080,
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true
    },
    "domainOverride": ["http", "tls"]
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "************g",
          "port": 443,
          "users": [
            {
              "id": "c************",
              "alterId": 10,
              "security": "none"
            }
          ]
        }
      ]
    },
    "mux": {
      "enabled": true
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "wsSettings": {
        "path": "/ws"
      }
    }
  },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    },
    "tlsSettings": {
      "allowInsecure": true
    }
  },
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "208.67.220.220",
      "208.67.222.222"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPOnDemand",
      "rules": [
        {
          "type": "field",
          "domain": [
            "geosite:cn"
          ],
          "outboundTag": "direct"
        },{
          "type": "field",
          "ip": [
            "geoip:cn",
            "geoip:private"
          ],
          "outboundTag": "direct"
        }
      ]
    }
  },
  "policy": {
    "levels": {
      "0": {"uplinkOnly": 0}
    }
  }
}

Caddy配置文件

http://***************g {
    timeouts none
    gzip
    timeouts none
    proxy /ws 127.0.0.1:11444 {
        websocket
    }
    filemanager / /root {
        database /root/caddy/filemanager.db
        locale zh-cn
    }
}

All 14 comments

用过Nginx,老502,搜过来的那些解答没有一点用= =就直接用V2ray内置的了,结果套了CDN也没招

你的客户端的streamSettings写在了一个奇怪的地方

还是一样,换顺序没啥差别,不过不论是Nginx反代做WS,还是直接做WS,通过CF的CDN后直接访问那个域名都是502错误

2018/03/28 18:28:17 [Warning] App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [dial tcp 104.18.56.5:23371: operation was canceled dial tcp: operation was canceled] > Retry: all retry attempts failed

看下 cloudflare 是不是 Crypto->ssl->Full

并不是,是Flexible

@SnorlaxYum 你换成 Full(Strict) 应该就可以套 cdn 了。
参考

@Voleking 没有用,一样的错误,估计肯定不是SSL的问题,security前面换成none都没用

Cloudflare并没有问题

我遇到跟你一样的问题

服务端

{
  "log" : {
    "access": "/root/v2ray/access.log",
    "error": "/root/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 11443,
    "listen": "127.0.0.1",
    "protocol": "vmess",
    "allocate": {
        "strategy": "always"
    },
    "settings": {
      "udp": true,
      "clients": [
        {
          "id": "c***********51",
          "level": 1,
          "alterId": 10,
          "mail": "*********m"
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "auto",
      "wsSettings": {
        "path": "/ws"
      }
    }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    }
  }
}

客户端

{
  "log": {
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1080,
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true
    },
    "domainOverride": ["http", "tls"]
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "************g",
          "port": 443,
          "users": [
            {
              "id": "c************",
              "alterId": 10,
              "security": "none"
            }
          ]
        }
      ]
    },
    "mux": {
      "enabled": true
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "wsSettings": {
        "path": "/ws"
      }
    }
  },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    },
    "tlsSettings": {
      "allowInsecure": true
    }
  },
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "208.67.220.220",
      "208.67.222.222"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPOnDemand",
      "rules": [
        {
          "type": "field",
          "domain": [
            "geosite:cn"
          ],
          "outboundTag": "direct"
        },{
          "type": "field",
          "ip": [
            "geoip:cn",
            "geoip:private"
          ],
          "outboundTag": "direct"
        }
      ]
    }
  },
  "policy": {
    "levels": {
      "0": {"uplinkOnly": 0}
    }
  }
}

Caddy配置文件

http://***************g {
    timeouts none
    gzip
    timeouts none
    proxy /ws 127.0.0.1:11444 {
        websocket
    }
    filemanager / /root {
        database /root/caddy/filemanager.db
        locale zh-cn
    }
}

@523860169 对应页面502,客户端错误:
2018/03/30 21:04:50 [Warning] [1106587986] App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [dial tcp 104.18.56.5:23371: i/o timeout dial tcp 104.18.57.5:23371: operation was canceled dial tcp: operation was canceled] > Retry: all retry attempts failed

客户端

{
  "dns":{
    "servers":[ 
        "4.2.2.1",
        "4.2.2.2"
    ]
  },
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1080,  
    "listen": "127.0.0.1",
    "protocol": "socks",
    "settings": {
      "udp":true,"auth":"noauth" 
    }, 
    "domainOverride": ["http", "tls"]
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [{
        "address": "某地址", 
        "port": 443,  
        "users": [{ "id": "某","security":"none" }]
      }]
    }
  },
  "mux":{"enabled":true},
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "wsSettings": {
        "path": "/ray/"
      }
    },
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    },
    "tlsSettings": {
      "allowInsecure": true
    }
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
      {
        "type": "field",
        "domain": [
          "geosite:cn"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "ip": [
          "geoip:private",
          "geoip:cn"
        ],
        "outboundTag": "direct"
      }
    ]
    }
  },
  "policy": {
    "levels": {
      "0": {"uplinkOnly": 0}
    }
  }
}

服务器:

  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 23371,
    "listen":"127.0.0.1",
    "protocol": "vmess",
    "allocate": {
        "strategy": "always"
    },
    "settings": {
      "udp":true,
      "clients": [
              { "id": "某" }
      ]
    }
  },
    "streamSettings": {
      "network": "ws",
      "security": "auto",
      "wsSettings": {"path": "/ray/"}
      },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "outboundDetour": [],
  "transport": {
    "tcpSettings": {
      "connectionReuse": true
    },
    "wsSettings": {
      "connectionReuse": true
    }
  }
}

你客户端的配置有点乱,好像有错误
mux和streamsettings应该在outbound内

建议把我上面的客户端配置完整复制了,再更改

@523860169 谢谢,真的可以了~~

Was this page helpful?
0 / 5 - 0 ratings