[GH-ISSUE #5158] [Question]: The IP and domain routing rule is not working #3625

Closed
opened 2026-10-31 20:33:48 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @navipostgm-ops on GitHub (Jun 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5158

What are you trying to do?

Greetings!
I can't seem to get a routing rule to work that directs a specific range of domains and IP addresses to a separate outbound channel.
If I direct all traffic to this outbound channel, it works and the channel allows traffic to pass through. What am I doing wrong?

Image Image

What have you already tried?

No response

3x-ui version

3.3.0

How did you install 3x-ui?

install.sh script

Operating system

Debian 13

Screenshots or config snippets

{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
},
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "blocked"
},
{
"type": "field",
"protocol": [
"bittorrent"
],
"outboundTag": "blocked"
},
{
"type": "field",
"domain": [
"cdn-telegram.org",
"comments.app",
"contest.com",
"fragment.com",
"graph.org",
"quiz.directory",
"t.me",
"tdesktop.com",
"telega.one",
"telegra.ph",
"telegram-cdn.org",
"telegram.dog",
"telegram.me",
"telegram.org",
"telegram.space",
"telesco.pe",
"tg.dev",
"tx.me",
"usercontent.dev",
"k.telegram.org",
"web.telegram.org",
"z.telegram.org"
],
"ip": [
"91.105.192.0/23",
"91.108.4.0/22",
"91.108.8.0/22",
"91.108.12.0/22",
"91.108.16.0/22",
"91.108.20.0/22",
"91.108.56.0/22",
"91.108.58.0/23",
"95.161.64.0/20",
"149.154.160.0/20",
"149.154.162.0/23",
"149.154.164.0/23",
"149.154.166.0/23",
"149.154.168.0/22",
"149.154.172.0/22",
"185.76.151.0/24",
"188.166.0.0/16",
"104.16.0.0/12",
"172.64.0.0/10",
"188.114.96.0/22",
"3.32.0.0/15",
"13.248.128.0/18",
"44.224.0.0/15",
"52.32.0.0/12",
"151.101.0.0/16",
"49.12.0.0/14",
"95.216.0.0/15",
"15.204.0.0/15",
"35.128.0.0/10"
],
"network": "TCP,UDP",
"outboundTag": "ovpn"
}

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @navipostgm-ops on GitHub (Jun 10, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5158 ### What are you trying to do? Greetings! I can't seem to get a routing rule to work that directs a specific range of domains and IP addresses to a separate outbound channel. If I direct all traffic to this outbound channel, it works and the channel allows traffic to pass through. What am I doing wrong? <img width="640" height="876" alt="Image" src="https://github.com/user-attachments/assets/c7f18092-548d-48ca-8389-3e4c2aab621a" /> <img width="1444" height="221" alt="Image" src="https://github.com/user-attachments/assets/672b5c7c-6257-4158-ba36-f450529860a5" /> ### What have you already tried? _No response_ ### 3x-ui version 3.3.0 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 ### Screenshots or config snippets { "type": "field", "inboundTag": [ "api" ], "outboundTag": "api" }, { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "blocked" }, { "type": "field", "protocol": [ "bittorrent" ], "outboundTag": "blocked" }, { "type": "field", "domain": [ "cdn-telegram.org", "comments.app", "contest.com", "fragment.com", "graph.org", "quiz.directory", "t.me", "tdesktop.com", "telega.one", "telegra.ph", "telegram-cdn.org", "telegram.dog", "telegram.me", "telegram.org", "telegram.space", "telesco.pe", "tg.dev", "tx.me", "usercontent.dev", "k.telegram.org", "web.telegram.org", "z.telegram.org" ], "ip": [ "91.105.192.0/23", "91.108.4.0/22", "91.108.8.0/22", "91.108.12.0/22", "91.108.16.0/22", "91.108.20.0/22", "91.108.56.0/22", "91.108.58.0/23", "95.161.64.0/20", "149.154.160.0/20", "149.154.162.0/23", "149.154.164.0/23", "149.154.166.0/23", "149.154.168.0/22", "149.154.172.0/22", "185.76.151.0/24", "188.166.0.0/16", "104.16.0.0/12", "172.64.0.0/10", "188.114.96.0/22", "3.32.0.0/15", "13.248.128.0/18", "44.224.0.0/15", "52.32.0.0/12", "151.101.0.0/16", "49.12.0.0/14", "95.216.0.0/15", "15.204.0.0/15", "35.128.0.0/10" ], "network": "TCP,UDP", "outboundTag": "ovpn" } ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
bsakaguchi 2026-10-31 20:33:48 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 10, 2026):

Root cause: Xray-core AND logic when a rule has both domain and ip fields. When multiple condition fields appear in the same rule object, Xray-core requires ALL of them to match simultaneously. In practice this almost never triggers: a SOCKS5 or HTTP CONNECT request carries a domain name but no IP so the ip condition fails and the rule is skipped; a direct connection to a Telegram IP carries an IP but no domain so the domain condition fails and the rule is skipped. This is why routing all traffic to the outbound works fine but the combined domain+ip rule has no effect. Fix: replace the single combined rule with two rules in Xray -> Routing, both pointing to the ovpn outbound. Rule 1 has only the domain list (leave the IP field blank). Rule 2 has only the ip list (leave the Domain field blank). Xray stops at the first matching rule so a match on either is sufficient. Optional shortcut: if geodata is current on your server, use geosite:telegram for the domain rule and geoip:telegram for the IP rule instead of the long manual lists.

<!-- gh-comment-id:4668211467 --> @github-actions[bot] commented on GitHub (Jun 10, 2026): Root cause: Xray-core AND logic when a rule has both domain and ip fields. When multiple condition fields appear in the same rule object, Xray-core requires ALL of them to match simultaneously. In practice this almost never triggers: a SOCKS5 or HTTP CONNECT request carries a domain name but no IP so the ip condition fails and the rule is skipped; a direct connection to a Telegram IP carries an IP but no domain so the domain condition fails and the rule is skipped. This is why routing all traffic to the outbound works fine but the combined domain+ip rule has no effect. Fix: replace the single combined rule with two rules in Xray -> Routing, both pointing to the ovpn outbound. Rule 1 has only the domain list (leave the IP field blank). Rule 2 has only the ip list (leave the Domain field blank). Xray stops at the first matching rule so a match on either is sufficient. Optional shortcut: if geodata is current on your server, use geosite:telegram for the domain rule and geoip:telegram for the IP rule instead of the long manual lists.
Author
Owner

@navipostgm-ops commented on GitHub (Jun 10, 2026):

Yes, it worked! Thank you so much, kind person! )

<!-- gh-comment-id:4668269533 --> @navipostgm-ops commented on GitHub (Jun 10, 2026): Yes, it worked! Thank you so much, kind person! )
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3625
No description provided.