XrayUIXrayUI
  • How to install
  • Interface Overview
  • Importing the Configuration
  • Bypass/Redirect Policy
  • Subscription Management
  • DNS Leak
CLI
Changelog
  • English
  • Russian
  • How to install
  • Interface Overview
  • Importing the Configuration
  • Bypass/Redirect Policy
  • Subscription Management
  • DNS Leak
CLI
Changelog
  • English
  • Russian
  • Guides

    • How to install
    • Interface Overview
    • Importing the Configuration
    • Bypass/Redirect Policy
    • Subscription Management
    • DNS Leak
  • CLI
  • Changelog

Bypass/Redirect Policy

The Bypass/Redirect Policy allows you to fine-tune how traffic is handled by Xray on a per-port or per-device (MAC address) basis.

  • Bypass means traffic does not go through Xray by default, unless you explicitly specify certain ports to be redirected.
  • Redirect means traffic does go through Xray by default, unless you explicitly exclude certain ports.

Info

B/R Policies are rules applied just before traffic is routed through the Xray service.

Why Use It?

You might have devices or applications that you do not want to proxy—perhaps internal services or local game servers.

Conversely, you might want to proxy only specific ports (e.g., 443) while leaving all other traffic untouched.

Or, you may need a particular device (e.g., your PC) to be fully redirected to Xray, while excluding certain ports for that device.

This flexible policy system lets you achieve all these scenarios and more.

Policy Schema

r/bpolicy

To manage B/R Policies, click the Manage button in the Routing section.

Info

By default, if no rules are specified, a dynamic general rule is applied: all traffic is redirected to the Xray process.

Examples

Below is a table arranged from the simplest configuration (only setting a mode) to more detailed ones (specifying ports and devices). This helps illustrate how different combinations change the final behavior.

#ConfigurationExample (simplified)Effect on Devices
1Only bypassmode: bypass, no MAC/portsAll traffic bypasses Xray (nothing is redirected).
2Only redirectmode: redirect, no MAC/portsAll traffic is redirected to Xray (no excluded ports).
3bypass + portmode: bypass, tcp/udp=5060Traffic on port 5060 is redirected to Xray; all other traffic bypasses Xray.
4redirect + portmode: redirect, tcp/udp=5060Traffic on port 5060 bypasses Xray; all other traffic is redirected.
5bypass + MACmode: bypass, mac=AA:BB...All traffic for that device bypasses Xray (no ports specified to redirect).
6redirect + MACmode: redirect, mac=AA:BB...All traffic for that device is redirected (no excluded ports). Other devices are unaffected.
7redirect + MAC + portsmode: redirect, mac=..., ports=5060For that device: traffic on port 5060 bypasses Xray; all other traffic is redirected.
8bypass + MAC + portsmode: bypass, mac=..., ports=5060For that device: traffic on port 5060 is redirected to Xray; all other traffic bypasses Xray.
Last Updated: 7/29/25, 10:23 PM
Contributors: Daniel Lavrushin
Prev
Importing the Configuration
Next
Subscription Management