Hiddify-Manager icon indicating copy to clipboard operation
Hiddify-Manager copied to clipboard

Implement Reverse Proxy Functionality

Open mehdikhody opened this issue 9 months ago • 1 comments

​Hello, First and foremost, I would like to extend my heartfelt gratitude to all the contributors of the Hiddify-Manager project. Your dedication and hard work have been instrumental in developing this robust tool, and your efforts are deeply appreciated.

I would like to suggest the addition of a reverse proxy feature in Hiddify-Manager, similar to the functionality provided by 3x-ui. This feature would involve installing panels on both the bridge (relay) and upstream (main) servers.

Proposed Configuration: Bridge Server (config.json):

{
  "inbounds": [
    ...,
    {
      "port": 2083,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "65e9cc15-0916-4ebd-bc20-9ed7d06cdac9"
          }
        ]
      },
      "streamSettings": {
        // Additional stream settings
      }
    }
  ],
  "rules": [
    ...,
    {
      "outboundTag": "reverse-relay",
      "inboundTag": ["inbound-2083"],
      "domain": ["full:relay.xui"],
      "type": "field"
    },
    {
      "outboundTag": "reverse-relay",
      "inboundTag": ["inbound-80", "inbound-443"],
      "type": "field"
    }
  ],
  "reverse": {
    "portals": [
      {
        "tag": "reverse-relay",
        "domain": "relay.xui"
      }
    ]
  }
}

Upstream Server (config.json):

{
  ...,
  "outbounds": [
    ...,
    {
      "tag": "relay",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "relay.server.com",
            "port": 2083,
            "users": [
              {
                "id": "65e9cc15-0916-4ebd-bc20-9ed7d06cdac9"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        // Additional stream settings
      }
    }
  ],
  "routing": [
    ...,
    {
      "domain": ["full:relay.xui"],
      "outboundTag": "relay",
      "inboundTag": ["reverse-relay"],
      "type": "field"
    },
    {
      "outboundTag": "direct",
      "inboundTag": ["reverse-relay"],
      "type": "field"
    }
  ],
  "reverse": {
    "bridges": [
      {
        "tag": "reverse-relay",
        "domain": "relay.xui"
      }
    ]
  }
}

In this setup, the upstream server connects to the bridge server, establishing a communication channel between the two. The bridge server is configured to forward inbound traffic on ports 80 and 443 to the upstream server, effectively acting as a reverse proxy.​

Thank you for considering this enhancement.

mehdikhody avatar Mar 21 '25 16:03 mehdikhody

thanks for the pr we will look into it

litoosh13 avatar Mar 28 '25 06:03 litoosh13