XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
25.47k stars 3.94k forks source link

Reverse proxy not working #1154

Closed mazzz1y closed 2 years ago

mazzz1y commented 2 years ago

Hello,

I want to use "Reverse proxy" to connect from Client to Server under NAT. If I understand it correctly, with the following configuration I'm should able to connect,but I can't. Maybe I didn't get something from configuration, but not sure

Client -----XTLS/VLESS----> Public Server:443 <-----XTLS/VLESS---- Server under NAT

Public server Configuration:

  "reverse":{
    "portals":[
      {
        "tag":"portal",
        "domain":"nat.com"
      }
    ]
  },
  "routing": {
    "rules": [
      {
        "type":"field",
        "inboundTag": [
          "xtls-vless"
        ],
        "port": "2222",
        "outboundTag":"portal"
      }
    ]
  }

Server under NAT configuration:

"reverse":{
    "bridges":[
      {
        "tag":"bridge",
        "domain":"nat.com"
      }
    ]
  },
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": ["bridge"],
        "domain": ["full:nat.com"],
        "outboundTag": "xtls-vless"
      },
      {
        "type":"field",
        "inboundTag": [
          "bridge"
        ],
        "outboundTag":"ssh"
      }
    ]
  },
  "outbounds": [
    {
      "tag": "ssh",
      "protocol": "freedom",
      "settings": {
        "redirect": "127.0.0.1:22"
      }
    }
  ]

Attempt to connect over socks(127.0.0.1:1080) -> xtls-vless:

ssh -o ProxyCommand='nc -x 127.0.0.1:1080 %h %p' -p2222 user@1.2.3.4

Log when I'm trying to connect:

chika0801 commented 2 years ago

https://github.com/XTLS/Xray-examples/tree/main/ReverseProxy

这儿的例子能不能帮到你。

mazzz1y commented 2 years ago

这儿的例子能不能帮到你。

谢谢,我之前没看到 我会查的

mazzz1y commented 2 years ago

https://github.com/XTLS/Xray-examples/tree/main/ReverseProxy 这儿的例子能不能帮到你。

It works, thanks a lot.

Need to create separated inbound for interconn connection and route all traffic from interconn to portal. This means that impossible to use existing xtls inbound for reverse proxy.

Closing this out, maybe it will be helpful for other users

AlefbeMedia commented 10 months ago

Need to create separated inbound for interconn connection and route all traffic from interconn to portal. This means that impossible to use existing xtls inbound for reverse proxy.

Closing this out, maybe it will be helpful for other users

In this method, can the external server (bridge) be used as the main server (the server on which the panel is installed)? If yes How?