XrayR-project / XrayR

A Xray backend framework that can easily support many panels. 一个基于Xray的后端框架,支持V2ay,Trojan,Shadowsocks协议,极易扩展,支持多面板对接
https://xrayr-project.github.io/XrayR-doc/
Mozilla Public License 2.0
2.08k stars 834 forks source link

Fallback not working with vless+ws+nginx #343

Closed mohamedfhelmy closed 1 year ago

mohamedfhelmy commented 1 year ago

Hi. Fallback is not working with vless+ws+nginx, it gives badrequest, works ok with Trojan but not vless.

Septrum101 commented 1 year ago

No detail logs?

mohamedfhelmy commented 1 year ago

It is not showing any log entries in xrayr log, i just see bad request in browser when i visit the site, if i change nodetype to Trojan it works and https show the html site when i visit it in browser, same if i use http i see the site, but if i use https and vless it shows bad request, are you able to make it work on your side using vless and fallback ?

May 28 15:38:13 45.138.86.35 XrayR[13523]: 2023/05/28 15:38:13 Start the panel.. May 28 15:38:13 45.138.86.35 XrayR[13523]: 2023/05/28 15:38:13 Xray Core Version: 1.7.5 May 28 15:38:13 45.138.86.35 XrayR[13523]: 2023/05/28 15:38:13 [Warning] core: Xray 1.7.5 started May 28 15:38:14 45.138.86.35 XrayR[13523]: 2023/05/28 15:38:14 [Warning] transport/internet/websocket: accepting PROXY protocol

  NodeType: V2ray # Node type: V2ray, Shadowsocks, Trojan, Shadowsocks-Plugin
  Timeout: 30 # Timeout for the api request
  EnableVless: true # Enable Vless for V2ray Type
  EnableXTLS: false # Enable XTLS for V2ray and Trojan
  SpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disable
  DeviceLimit: 6 # Local settings will replace remote settings, 0 means disable
  RuleListPath: # /etc/XrayR/rulelist Path to local rulelist file
ControllerConfig:
  ListenIP: 127.0.0.1 # IP address you want to listen
  SendIP: 0.0.0.0 # IP address you want to send pacakage
  UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.
  EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well
  DNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategy
  EnableProxyProtocol: true # Only works for WebSocket and TCP
  AutoSpeedLimitConfig:
    Limit: 0 # Warned speed. Set to 0 to disable AutoSpeedLimit (mbps)
    WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately.
    LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps)
    LimitDuration: 0 # How many minutes will the limiting last (unit: minute)
  GlobalDeviceLimitConfig:
    Enable: true # Enable the global device limit of a user
    RedisAddr: x.x.x.x # The redis server address
    RedisPassword: xxxxx# Redis password
    RedisDB: 0 # Redis DB
    Timeout: 5 # Timeout for redis request
    Expiry: 60 # Expiry time (second)
  EnableFallback: true # Only support for Trojan and Vless
  FallBackConfigs:  # Support multiple fallbacks
    -
      SNI: # TLS SNI(Server Name Indication), Empty for any
      Alpn: # Alpn, Empty for any
      Path: # HTTP PATH, Empty for any
      Dest: iphere:80 # Required, Destination of fallback, check https://xtls.github.io/config/features/fallback.html for details.
      ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsable
Septrum101 commented 1 year ago

Alpn: http/1.1

mohamedfhelmy commented 1 year ago

Tried it and restarted but still same issue, whether i use domain or direct ip still say bad request with https, i enabled debug and it is now saying that it can't find default alpn, do you think we need to specify xver as mentioned here https://github.com/XTLS/Xray-core/issues/249 ? i am using same method of vless +ws

May 28 16:00:48 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:48 [Info] transport/internet/websocket: failed to convert to WebSocket connection > websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header May 28 16:00:49 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:49 [Info] [1556362230] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > proxy/vless/inbound: failed to transfer request payload > websocket: close 1000 (normal) May 28 16:00:49 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:49 [Info] [1888153957] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > context canceled May 28 16:00:49 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:49 [Info] [636509109] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > proxy/vless/inbound: failed to transfer request payload > websocket: close 1000 (normal) May 28 16:00:50 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:50 [Info] [3841113973] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > proxy/vless/inbound: failed to transfer request payload > websocket: close 1000 (normal) May 28 16:00:50 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:50 [Info] [1349994101] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > proxy/vless/inbound: failed to transfer request payload > websocket: close 1000 (normal) May 28 16:00:50 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:50 [Info] [1379676884] proxy/vless/inbound: firstLen = 0 May 28 16:00:50 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:50 [Info] [1379676884] proxy/vless/inbound: fallback starts > proxy/vless/inbound: fallback directly May 28 16:00:50 45.138.86.35 XrayR[14471]: 2023/05/28 16:00:50 [Warning] [1379676884] app/proxyman/inbound: connection ends > proxy/vless/inbound: failed to find the default "alpn" config

      Alpn: "http/1.1" # Alpn, Empty for any
Septrum101 commented 1 year ago

This is not xr's problem. You can goto xray-core group for help.

mohamedfhelmy commented 1 year ago

how to specify the xver inside xrayr ? that is the fix per the link

Septrum101 commented 1 year ago

ProxyProtocolVer == xver

mohamedfhelmy commented 1 year ago

Thanks, tried ProxyProtocolVer: 1 per the fix mentioned on that issue but no go, didn't make a diff, is there anyway to debug that ProxyProtocolVer is actually getting passed to nginx stream, if not then no worries will just close issue, will use diff method

Septrum101 commented 1 year ago

You can use xray-core directly to debug this feat.

ClashUS commented 1 year ago

Dose Author solve this problem? I got same problem.