SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
19.91k stars 2.36k forks source link

Vless Vision GRPC 无法通过nginx 转发 #387

Closed debiansid closed 1 year ago

debiansid commented 1 year ago

Welcome

Description of the problem

vless vision 无法通过nginx转发

Version of sing-box

``` sing-box version 1.2-beta5 Environment: go1.20.1 linux/amd64 Tags: osusergo,netgo,with_quic,with_grpc,with_gvisor,with_utls,with_reality_server Revision: 5ce3ddee9be640c309a23341951434861dc4c2e0 CGO: enabled ```

Server and client configuration file

```console { "type": "vless", "tag": "vless-vision-grpc", "listen": "127.0.0.1", "listen_port": 52005, "sniff": true, "sniff_override_destination": true, "domain_strategy": "ipv4_only", "proxy_protocol": true, "proxy_protocol_accept_no_header": true, "users": [ { "name": "bigbigwall", "uuid": "6d0ddb31-ee86-4ba2-875a-b81d0f6f8efc" } ], "tls": { "enabled": true, "alpn": [ "h2" ], "server_name": "domain", "certificate_path": "/etc/nginx/ssl/ssl.crt", "key_path": "/etc/nginx/ssl/ssl.key" }, "transport": { "type": "grpc", "service_name": "TunServiceVless" } }, ``` nginx grpc conf ``` location /TunServiceVless { if ($content_type !~ "application/grpc") { return 404; } if ($request_method != "POST") { return 404; } grpc_set_header Connection ""; client_body_timeout 300s; client_max_body_size 0; client_body_buffer_size 512k; grpc_connect_timeout 10s; proxy_buffering off; #grpc_buffer_size 100m; grpc_read_timeout 1d; grpc_send_timeout 1d; grpc_socket_keepalive on; grpc_pass grpc://127.0.0.1:52005; grpc_set_header X-Real-IP $remote_addr; grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } ```

Server and client log file

```console 2023/02/27 06:35:42 [error] 1326#1326: *3 broken header: "^V^C^A^@{^A^@^@w^C^C<85>_<90>ëL%7ÅmÏïI8^\<8d>Ò6Rd^R" while reading PROXY protocol, client: 192.241.213.67, server: 0.0.0.0:443 2023/02/27 06:42:33 [error] 1326#1326: *5 broken header: "^V^C^A^B^@^A^@^Aü^C^C}¨^_f^T\Å <87>^E<96>»±,Q/R"½<9b>Ê1¢^U-|ÑÓ(7ô9 ~ë'7K´^S^_[^PZT^BÞ;¥ý<9e><96>±òªÿ<92>^T<91>|´<9d><80>@Ò^@ ^Z^Z^S^A^S^B^S^CÀ+À/À,À0̨̩À^SÀ^T^@<9c>^@<9d>^@/^@5^A^@^A<93>ÚÚ^@^@ÿ^A^@^A^@^@^K^@^B^A^@^@^[^@^C^B^@^B^@3^@+^@)jj^@^A^@^@^]^@ õ^Uì^\2»<94>¸ù<90>E²8^LmE#îÓ<99>øZ<92>¯-DÀú<8c>" while reading PROXY protocol, client: 125.69.40.39, server: 0.0.0.0:443 ```
malikshi commented 1 year ago

sir, is it work?

debiansid commented 1 year ago

sir, is it work?

No you can't do that

malikshi commented 1 year ago

so vless ws/grpc xtls-rprx-vision with directive nginx won't work? it's not reality_server only vision