V2ray-core: vmess(TCP)+TLS配置启动成功无法正确上网

Created on 8 Dec 2018  ·  17Comments  ·  Source: v2ray/v2ray-core

提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。
除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。
如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。

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

服务器端配置:

{
    "log": {
        "error": "/var/log/v2ray/error.log",
        "loglevel": "debug",
        "access": "/var/log/v2ray/access.log"
    },
    "inbounds": [
        {
            "port": 443,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "************************",
                        "alterId": 16
                    }
                ]
            },
            "streamSettings":{
                "network": "tcp",
                "security": "tls", // security 要设置为 tls 才会启用 TLS
                "tlsSettings":{
                    "certificates":[{
                        "certificateFile": "/etc/v2ray/******.pem", // 证书文件
                        "keyFile": "/etc/v2ray/******.key" // 密钥文件
                    }]
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {}
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ],
    "routing": {
        "rules": [
            {
                "type": "field",
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "blocked"
            }
        ]
    }
}

客户端配置:
客户端使用V2rayX

{
    "policy": {
        "levels": {
            "0": {
                "uplinkOnly": 0
            }
        }
    },
    "dns": {
        "servers": [
            "localhost"
        ]
    },
    "outboundDetour": [{
        "protocol": "freedom",
        "tag": "direct",
        "settings": {}
    }],
    "inbound": {
        "listen": "127.0.0.1",
        "port": 1086,
        "protocol": "socks",
        "settings": {
            "auth": "noauth",
            "udp": false,
            "ip": "127.0.0.1"
        }
    },
    "inboundDetour": [{
        "listen": "127.0.0.1",
        "allocate": {
            "strategy": "always",
            "refresh": 5,
            "concurrency": 3
        },
        "port": 1087,
        "protocol": "http",
        "tag": "httpDetour",
        "domainOverride": [
            "http",
            "tls"
        ],
        "streamSettings": {},
        "settings": {
            "timeout": 0
        }
    }],
    "routing": {
        "strategy": "rules",
        "settings": {
            "domainStrategy": "IPIfNonMatch",
            "rules": [{
                    "domain": [
                        "localhost",
                        "domain:mzstatic.com",
                        "domain:me.com",
                        "domain:lookup-api.apple.com",
                        "domain:itunes.com",
                        "domain:itunes.apple.com",
                        "domain:icloud-content.com",
                        "domain:icloud.com",
                        "domain:cdn-apple.com",
                        "domain:apple-cloudkit.com",
                        "domain:apple.com",
                        "domain:apple.co",
                        "domain:aaplimg.com",
                        "domain:guzzoni.apple.com",
                        "geosite:cn"
                    ],
                    "type": "field",
                    "outboundTag": "direct"
                },
                {
                    "type": "field",
                    "outboundTag": "direct",
                    "ip": [
                        "geoip:private",
                        "geoip:cn"
                    ]
                }
            ]
        }
    },
    "outbound": {
        "sendThrough": "0.0.0.0",
        "mux": {
            "enabled": true,
            "concurrency": 8
        },
        "protocol": "vmess",
        "settings": {
            "vnext": [{
                "address": "www.***.com",
                "port": 443,
                "users": [{
                    "id": "************************",
                    "alterId": 16,
                    "security": "none",
                    "level": 1
                }],
                "remark": "test"
            }]
        },
        "streamSettings": {
            "wsSettings": {
                "path": "",
                "headers": {}
            },
            "sockopt": {},
            "tlsSettings": {
                "serverName": "www.***.com",
                "allowInsecure": true
            },
            "httpSettings": {
                "path": ""
            },
            "kcpSettings": {
                "header": {
                    "type": "none"
                },
                "mtu": 1350,
                "congestion": false,
                "tti": 50,
                "uplinkCapacity": 5,
                "writeBufferSize": 1,
                "readBufferSize": 2,
                "downlinkCapacity": 20
            },
            "tcpSettings": {
                "header": {
                    "type": "none"
                }
            },
            "security": "tls",
            "network": "tcp"
        }
    }
}

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

服务器端错误日志:

服务端无日志,看着应该客户端请求没有到达服务端

客户端错误日志:

2018/12/08 18:19:08 [Debug] v2ray.com/core/app/log: Logger started
2018/12/08 18:19:08 [Warning] v2ray.com/core: V2Ray 4.7.0 started
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [encrypted-tbn0.gstatic.com:443] with URL [//encrypted-tbn0.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.gstatic.com:443] with URL [//www.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [lh3.googleusercontent.com:443] with URL [//lh3.googleusercontent.com:443]
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [ssl.gstatic.com:443] with URL [//ssl.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/dispatcher: sniffed domain: www.google.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.google.com
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/app/dispatcher: sniffed domain: www.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.gstatic.com
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/dispatcher: sniffed domain: lh3.googleusercontent.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: lh3.googleusercontent.com
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/dispatcher: sniffed domain: encrypted-tbn0.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: encrypted-tbn0.gstatic.com
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/app/dispatcher: sniffed domain: ssl.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: ssl.gstatic.com
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/dispatcher: default route for tcp:www.google.com:443
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/dispatcher: default route for tcp:encrypted-tbn0.gstatic.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/dispatcher: default route for tcp:lh3.googleusercontent.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/app/dispatcher: taking detour [direct] for [tcp:ssl.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/proxy/freedom: opening connection to tcp:ssl.gstatic.com:443
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:ssl.gstatic.com:443
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/app/dispatcher: taking detour [direct] for [tcp:www.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/proxy/freedom: opening connection to tcp:www.gstatic.com:443
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.gstatic.com:443
2018/12/08 18:19:09 [Info] [3398746293] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:encrypted-tbn0.gstatic.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:www.google.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:lh3.googleusercontent.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 181 but actually 168
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 237 but actually 185
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 165 but actually 148
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/app/dispatcher: sniffed domain: www.google.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.google.com
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/app/dispatcher: default route for tcp:www.google.com:443
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:www.google.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 18 but actually 197
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > context canceled
2018/12/08 18:19:14 [Debug] v2ray.com/core/app/log: Logger closing

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

2018/12/08 18:19:09 127.0.0.1:51432 accepted //encrypted-tbn0.gstatic.com:443  
2018/12/08 18:19:09 127.0.0.1:51428 accepted //www.google.com:443  
2018/12/08 18:19:09 127.0.0.1:51429 accepted //www.gstatic.com:443  
2018/12/08 18:19:09 127.0.0.1:51430 accepted //lh3.googleusercontent.com:443  
2018/12/08 18:19:09 127.0.0.1:51431 accepted //ssl.gstatic.com:443  
2018/12/08 18:19:09 127.0.0.1:51440 accepted //www.google.com:443  

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

9) 如果 V2Ray 无法启动,请附上 --test 输出。

通常的命令为 /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json。请按实际情况修改。

10) 如果 V2Ray 服务运行不正常,请附上 journal 日志。

通常的命令为 journalctl -u v2ray

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

Most helpful comment

@c16ee5a6 为什么要关注配置,因为作为局外人,根本不知道当事人自己的系统发生了什么,是什么状态。通过重新配置一步步查错是最快的方案,能排除很多其它的因素。况且当事人给出的比较有用的信息也就是配置了。

另外请务必学习手写配置!!!自动脚本的涉及的变量太多,一个个控制极其麻烦。成功则已,否则没人知道到底出了什么问题。

All 17 comments

没有人看看吗

确定端口开着,我配置一个简单vmess,ss 可以通过443访问到
上面那个配置是大佬修改过的?可以拿过来修改后直接用吗

我在将服务端升级到4.8后也出现了无法访问的问题,4.6的时候可以正常用,升级后一模一样的配置文件就不能用了。不过我用的是caddy+ws,服务端日志提示invalid user

2018/12/12 02:07:09 xxx.xxx.xxx.xxx:13075 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2018/12/12 02:07:13 xxx.xxx.xxx.xxx:13076 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user

证书文件我是从cloudflare上生成保存的,配置证书路径我确认过没问题了,特别奇怪的问题,我还下载了一套配置文件模板,改得一摸一样还是没有解决

@miy4mori 确认一下服务端和客户端时间

时间和时区都是一样的,id, level, alterId都核对过,服务器也重新部署过。
贴下我的配置,服务端:

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "dns": {
    "servers": [{
      "address": "1.1.1.1",
      "port": 53
    }, {
      "address": "8.8.8.8",
      "port": 53
    }, {
      "address": "8.8.4.4",
      "port": 53
    }],
    "clientIp": "0.0.0.0"
  },
  "stats": {},
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [{
      "type": "field",
      "outboundTag": "blocked",
      "protocol": ["bittorrent"]
    }, {
      "type": "field",
      "domain": ["geosite:cn"],
      "outboundTag": "blocked"
    }, {
      "type": "field",
      "ip": ["0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.88.99.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "224.0.0.0/4", "240.0.0.0/4", "255.255.255.255/32"],
      "outboundTag": "blocked"
    }, {
      "type": "field",
      "ip": ["geoip:cn"],
      "outboundTag": "blocked"
    }]
  },
  "policy": {
    "levels": {
      "0": {
        "handshake": 4,
        "connIdle": 300,
        "uplinkOnly": 2,
        "downlinkOnly": 5,
        "statsUserUplink": false,
        "statsUserDownlink": false,
        "bufferSize": 10240
      }
    },
    "system": {
      "statsInboundUplink": false,
      "statsInboundDownlink": false
    }
  },
  "inbound": {
    "port": 14741,
    "listen": "0.0.0.0",
    "protocol": "vmess",
    "settings": {
      "users": [{
        "id": "u-u-i-d",
        "alterId": 32,
        "level": 1,
        "security": "auto"
      }],
      "default": {
        "level": 1,
        "alterId": 32
      },
      "disableInsecureEncryption": false
    },
    "streamSettings": {
      "network": "mkcp"
    },
    "tag": "inbound-mkcp",
    "sniffing": {
      "enabled": false,
      "destOverride": ["http", "tls"]
    }
  },
  "outbound": {
    "sendThrough": "0.0.0.0",
    "protocol": "freedom",
    "settings": {
      "domainStrategy": "AsIs",
      "userLevel": 1
    },
    "tag": "freedom",
    "mux": {
      "enabled": false
    }
  },
  "inbounds": [{
    "port": 15951,
    "listen": "127.0.0.1",
    "protocol": "vmess",
    "settings": {
      "users": [{
        "id": "u-u-i-d",
        "level": 1,
        "alterId": 32
      }],
      "default": {
        "level": 1,
        "alterId": 32
      },
      "disableInsecureEncryption": false
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
        "path": "/vmess",
        "headers": {
          "Cache-Control": "private",
          "Connection": "Keep-Alive",
          "Content-Encoding": "gzip",
          "Content-Type": "text/html;charset=utf-8",
          "Server": "BWS/1.1",
          "Transfer-Encoding": "chunked"
        }
      }
    },
    "tag": "inbound-ws",
    "sniffing": {
      "enabled": false,
      "destOverride": ["http", "tls"]
    }
  }],
  "outbounds": [{
    "protocol": "blackhole",
    "tag": "blocked",
    "settings": {
      "response": {
        "type": "none"
      }
    }
  }],
  "transport": {
    "kcpSettings": {
      "mtu": 1350,
      "tti": 30,
      "uplinkCapacity": 20,
      "downlinkCapacity": 20,
      "congestion": true,
      "readBufferSize": 0,
      "writeBufferSize": 0,
      "header": {
        "type": "utp"
      }
    }
  }
}

客户端:

{
  "log": {
    "access": "access.log",
    "error": "error.log",
    "loglevel": "info"
  },
  "inbound": {
    "listen": "0.0.0.0",
    "port": 2048,
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": false
    },
    "sniffing": {
      "enabled": true,
      "destOverride": [
        "http",
        "tls"
      ]
    }
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 4096,
      "protocol": "http",
      "settings": {
        "timeout": 30,
        "allowTransparent": false
      },
      "sniffing": {
        "enabled": false,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    },
    {
      "listen": "0.0.0.0",
      "port": 53,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "8.8.8.8",
        "port": 53,
        "network": "tcp,udp",
        "timeout": 30,
        "followRedirect": false
      }
    },
    {
      "listen": "0.0.0.0",
      "port": 10240,
      "protocol": "dokodemo-door",
      "settings": {
        "network": "tcp,udp",
        "timeout": 30,
        "followRedirect": true
      }
    }
  ],
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "xxx.xxx.xxx.com",
          "port": 443,
          "users": [
            {
              "id": "u-u-i-d",
              "level": 1,
              "alterId": 32
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "wsSettings": {
        "path": "/vmess"
      }
    },
    "tag": "remote",
    "mux": {
      "enabled": false
    }
  },
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "AsIs"
      },
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "none"
        }
      },
      "tag": "blocked"
    }
  ],
  "dns": {
    "servers": [
      {
        "address": "1.1.1.1",
        "port": 53
      },
      {
        "address": "8.8.8.8",
        "port": 53
      },
      {
        "address": "8.8.4.4",
        "port": 53
      }
    ],
    "clientIp": "0.0.0.0"
  },
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "type": "field",
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ]
      },
      {
        "type": "field",
        "port": "54-79",
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "port": "81-442",
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "port": "444-65535",
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": [
          "geosite:speedtest"
        ],
        "outboundTag": "remote"
      },
      {
        "type": "field",
        "domain": [
          "geosite:cn"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "ip": [
          "0.0.0.0/8",
          "10.0.0.0/8",
          "100.64.0.0/10",
          "127.0.0.0/8",
          "169.254.0.0/16",
          "172.16.0.0/12",
          "192.0.0.0/24",
          "192.0.2.0/24",
          "192.88.99.0/24",
          "192.168.0.0/16",
          "198.18.0.0/15",
          "198.51.100.0/24",
          "203.0.113.0/24",
          "224.0.0.0/4",
          "240.0.0.0/4",
          "255.255.255.255/32"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "ip": [
          "geoip:cn"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "inboundTag": "socks",
        "outboundTag": "remote"
      }
    ]
  },
  "transport": {
    "kcpSettings": {
      "mtu": 1350,
      "tti": 30,
      "uplinkCapacity": 20,
      "downlinkCapacity": 20,
      "congestion": true,
      "readBufferSize": 0,
      "writeBufferSize": 0,
      "header": {
        "type": "utp"
      }
    }
  },
  "v2raygcon": {
    "alias": "CN2-WS",
    "description": ""
  }
}

你的客户端DNS没有被污染吧?我建议你先把客户端路由功能全部去掉然后直连代理,看能不能成功访问。
如果还是不行,建议你从VMess开始设置,先确保你的服务器上有一个访问的VMess的Inbound,然后自己动手写客户端的配置文件,因为这个自动生成的看着真心累……

@miy4mori 虽然我用的是Nginx,不过还是建议你去查一下Caddy的访问日志看有没有访问错误的情况,例如Centos本地转发很可能会出问题。建议利用Caddy搭建一个掩护用的网站,也方便查错。实在不行建议还是从基本的VMess开始配起,一点点查问题。
不过……我不知道服务端这块设置一堆的headers会发生什么,你服务器端的headers有gzip而客户端没有gzip会不会出问题。而且我觉得既然都用了Caddy,就把这些设置到Caddy上去,把这些工作交给专业的HTTP服务器来做不是更好?

@miy4mori 虽然我用的是Nginx,不过还是建议你去查一下Caddy的访问日志看有没有访问错误的情况,例如Centos本地转发很可能会出问题。建议利用Caddy搭建一个掩护用的网站,也方便查错。实在不行建议还是从基本的VMess开始配起,一点点查问题。
不过……我不知道服务端这块设置一堆的headers会发生什么,你服务器端的headers有gzip而客户端没有gzip会不会出问题。而且我觉得既然都用了Caddy,就把这些设置到Caddy上去,把这些工作交给专业的HTTP服务器来做不是更好?

这不是headers的问题,也不是什么gzip的问题,同配置的kcp也提示invalid user,这不可能是headers的问题。

@Chandler-Lu 我把服务端和客户端都发你了

inbound和inbounds你怎么弄了两个,outbound也是这样,新版的配置格式是这样的,全部在一个数组里面的,请参考新版格式编写:
`
{
"log": {},
"api": {},
"dns": {},
"stats": {},
"routing": {},
"policy": {},
"reverse": {},
"inbounds": [],
"outbounds": [],
"transport": {}
}

`

你们怎么一直在讨论配置,应该关注的重点不是4.6能用4.8不能用吗?

@gh-tt 这个配置是兼容的,换成新版也一样提示invalid user
@c16ee5a6 说的对啊,我现在就想明白为什么时间时区一致,idlevelalterId一致的情况下会invalid user,难道还有别的什么情况会导致 invalid user

在几番折腾不出结果的时候,我把服务器重装系统,然后用了著名的一键脚本在服务器安装ws+tls+caddy,然后客户端还是v2rayX 就可以正常使用了,所以客户端不兼容应该排除出错的可能性了,剩下服务端正常一步步配置,把caddy换成nginx依然报错
nginx错误日志:

2018/12/08 18:19:08 [Debug] v2ray.com/core/app/log: Logger started
2018/12/08 18:19:08 [Warning] v2ray.com/core: V2Ray 4.7.0 started
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [encrypted-tbn0.gstatic.com:443] with URL [//encrypted-tbn0.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.gstatic.com:443] with URL [//www.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [lh3.googleusercontent.com:443] with URL [//lh3.googleusercontent.com:443]
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [ssl.gstatic.com:443] with URL [//ssl.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/dispatcher: sniffed domain: www.google.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.google.com
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/app/dispatcher: sniffed domain: www.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.gstatic.com
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/dispatcher: sniffed domain: lh3.googleusercontent.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: lh3.googleusercontent.com
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/dispatcher: sniffed domain: encrypted-tbn0.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: encrypted-tbn0.gstatic.com
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/app/dispatcher: sniffed domain: ssl.gstatic.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: ssl.gstatic.com
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/dispatcher: default route for tcp:www.google.com:443
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/dispatcher: default route for tcp:encrypted-tbn0.gstatic.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/dispatcher: default route for tcp:lh3.googleusercontent.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/app/dispatcher: taking detour [direct] for [tcp:ssl.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/proxy/freedom: opening connection to tcp:ssl.gstatic.com:443
2018/12/08 18:19:09 [Info] [3975335411] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:ssl.gstatic.com:443
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/app/dispatcher: taking detour [direct] for [tcp:www.gstatic.com:443]
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/proxy/freedom: opening connection to tcp:www.gstatic.com:443
2018/12/08 18:19:09 [Info] [3184829359] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.gstatic.com:443
2018/12/08 18:19:09 [Info] [3398746293] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:encrypted-tbn0.gstatic.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:www.google.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:lh3.googleusercontent.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 181 but actually 168
2018/12/08 18:19:09 [Info] [2693700360] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 237 but actually 185
2018/12/08 18:19:09 [Info] [3661339055] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 165 but actually 148
2018/12/08 18:19:09 [Info] [3563340624] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > io: read/write on closed pipe
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/proxy/http: request to Method [CONNECT] Host [www.google.com:443] with URL [//www.google.com:443]
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/app/dispatcher: sniffed domain: www.google.com
2018/12/08 18:19:09 [Info] v2ray.com/core/app/router: looking for IP for domain: www.google.com
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/app/dispatcher: default route for tcp:www.google.com:443
2018/12/08 18:19:09 [Info] [2269856647] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/proxy/vmess/outbound: tunneling request to tcp:www.google.com:443 via tcp:www.qqqqqqqqqqq.com:443
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: connection ends > v2ray.com/core/proxy/vmess/outbound: failed to read header > v2ray.com/core/proxy/vmess/encoding: unexpected response header. Expecting 18 but actually 197
2018/12/08 18:19:10 [Info] [2269856647] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/http: connection ends > context canceled
2018/12/08 18:19:14 [Debug] v2ray.com/core/app/log: Logger closing

v2ray客户端请求没有到达服务端的v2ray,没有v2ray相关日志

@c16ee5a6 为什么要关注配置,因为作为局外人,根本不知道当事人自己的系统发生了什么,是什么状态。通过重新配置一步步查错是最快的方案,能排除很多其它的因素。况且当事人给出的比较有用的信息也就是配置了。

另外请务必学习手写配置!!!自动脚本的涉及的变量太多,一个个控制极其麻烦。成功则已,否则没人知道到底出了什么问题。

@bososha 大佬,请问在哪里可以学习手写配置,我找不到官方的wiki在哪里。谢谢

@LeooooooooonChin 你最开始的配置,可能是遭到了劫持或者域名没有解析到正确IP上面。之后的nginx/caddy的问题,通常是path配置错误。

Secure Connection Failed occurs when viewing specific website, such as twitter.com, using Firefox.

Was this page helpful?
0 / 5 - 0 ratings