I use v2ray protocol to access global internet. For a long time it’s working fine.

However, after recent update, this warning popped: [Warning] common/errors: This feature WebSocket transport (with ALPN http/1.1, etc.) is deprecated and being migrated to XHTTP H2 & H3. Please update your config(s) according to release note and documentation before removal.

The source

seems that v2rayN is using xray core, and this project has get a new update: xhttp feature. and the author is recommending it.

Try switching to it

The config guide for the xray website was as confusing as v2ray website. So I have to figure everything out from scratch.

Luckily, I have learned some Go, and by inspecting its source code I find things are simple: just replace streamSettings part.

"streamSettings": {
    "network": "xhttp",
    "xhttpSettings": {
        "mode": "auto",
        "path": ""
    }
}

Also I find that json is very hard to write and understand. I know that v2ray/xray supports toml. However how to convert different data types between toml and json was unknown to me.

After some search, I get a doc, and by doing a experiment I got the right grammar.

Then I followed the example to config the xhttp mode. I first tried to change my default.nginx.conf by just add a path.

not working. Then I tried to copy the old vless config, by creating a separate website:

# /* vim: set filetype=nginx : */
server {
    charset utf-8;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;
    server_name vless.[].com;

    client_header_timeout 5m;
    keepalive_timeout 5m;

	location /vless {
        client_max_body_size 0;
        grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_body_timeout 5m;
        grpc_read_timeout 315;
        grpc_send_timeout 5m;
        grpc_pass unix:/dev/shm/xrxh.socket;
    }
}

(since this is a subconfig I don’t need to use listen directive. use it will cause error in certbot.) after config it in cloudflare dns and use certbot to apply SSL, I created the vlessx config:

[log]
loglevel = "warning"

[[inbounds]]
listen = "/dev/shm/xrxh.socket,0666"
protocol = "vless"

[[inbounds.settings.clients]]
id = "[]"

[inbounds.settings]
decryption = "none"

[inbounds.streamSettings]
network = "xhttp"

[inbounds.streamSettings.xhttpSettings]
path = "/"
mode = "auto"

[[outbounds]]
protocol = "freedom"

however things are not working.

debugging

I tried:

  • add/remove Hosts.
  • change paths.
  • change grpc to http, and change it back.
  • copy full vless settings, including the websocket upgrade.
   location / {
        proxy_pass http://localhost:10003;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Required for web sockets to function
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        gzip off;
    }
  • change port.
  • restart the service.
  • restart the service again.
  • covert toml to json, and restart the service.
  • try change grpc to http again.
  • add hosts, and xhttp mode in json.

But they are all not working. (BTW the v2rayN Ctrl+T to test a single server is broken)

the end?

Well Xray authors is advertizing this, and they also create an NFT as a donation method.

But this seems a very annoying prompt and idea. it brings issues to everyone, both users and maintainers.

after

I just forked xray and remove warning in the code.

Think I will keep a branch in case of the removal of websocket protocol.