v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.01k stars 8.95k forks source link

https访问绑定的二级域名时bad quest #498

Closed himan85 closed 6 years ago

himan85 commented 6 years ago

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) a:2.33。 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 a:访问绑定的二级域名时。 3) 你看到的不正常的现象是什么? a:v2ray+tls+ws+nginx,访问绑定的二级域名时bad quest。 4) 你期待看到的正确表现是怎样的? a:希望能在二级域名挂网页,更好的伪装。 5) 请附上你的配置文件(提交 Issue 前请隐藏服务器端IP地址)。 a: nginx配置: ———————————————————————————————————————— user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events { worker_connections 1024; }

http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}
server {
    listen       80;
    server_name  ;
    location / {
    root         /usr/share/nginx/html/ds;
    index index.html;
    }
}
server {
    listen  443 ssl;
    ssl on;
    ssl_certificate       /etc/v2ray/v2ray.crt;
    ssl_certificate_key   /etc/v2ray/v2ray.key;
    ssl_protocols         TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers           HIGH:!aNULL:!MD5;
    server_name           ;
    location / {
        proxy_redirect off; 
        proxy_pass http://localhost:10000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }

}

} ———————————————————————————————————————————— v2ray配置: ———————————————————————————————————————— { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbound": { "port": 10000, "listen":"127.0.0.1", "protocol": "vmess",
"settings": { "udp": true, "clients": [ { "id": " ",
"level": 1, "alterId": 80 } ], "default": { "level": 1, "alterId": 32 } }, "streamSettings": { "network": "ws", "security": "auto", "wsSettings": { "connectionReuse": true, "path": "" } } }, "outbound": { "protocol": "freedom", "settings": {}, "mux": { "concurrency": 8, "enabled": false } }, "outboundDetour": [ { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ], "routing": { "strategy": "rules", "settings": { "rules": [ { "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.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" } ] } } } ————————————————————————————————————————————

oing9179 commented 6 years ago

@himan85 Reply #1

给你两个提示:

  1. Bad request 对应的 HTTP 响应代码是多少?
  2. proxy_intercept_errors - nginx.org
himan85 commented 6 years ago

懂了,谢谢!

o0HalfLife0o commented 6 years ago

我按照这个教程搞的,但也是一直502,请问你最后怎么搞的?可以贴一下现在的配置文件吗

lniwn commented 6 years ago

@523860169 我照着楼上的方法试了下,可以的,写下来给你参考。

  1. 用浏览器访问你的ws对应的url,查看错误码,我这里的错误码是400 。
  2. 配置nginx的error_page,我这里直接按照404处理了。
    # Error page
    fastcgi_intercept_errors on;
    error_page 400 404 /404.html;
    location /your-v2ray-path{
        access_log   off;
        proxy_intercept_errors on;
    }

    access_log是用来关闭访问日志的,因为v2ray的访问没必要记录日志,否则会产生太多无意义的日志浪费空间。