← Back to Home

Happ routing profile from any website

Updated · NetRoute version 4.1.4

Happ is a cross-platform client on the Xray core for Windows, macOS, Linux, iOS, Android and TV platforms. What goes through the proxy is decided by a routing profile: lists of domains and addresses. NetRoute builds such a profile from a website as JSON, and it enters the app as a happ://routing/onadd/… link.

What is inside the file

A Happ routing profile is a JSON document with DNS and geo-file settings and six lists: what goes through the proxy, what goes direct and what is blocked — separately for domains and for addresses. NetRoute fills the proxy lists and leaves the rest at values Happ accepts by default:

{
  "Name": "NetRoute github.com",
  "GlobalProxy": "false",
  "RemoteDNSType": "DoH",
  "RemoteDNSDomain": "https://1.1.1.1/dns-query",
  "RemoteDNSIP": "1.1.1.1",
  "DomesticDNSType": "DoH",
  "DomesticDNSDomain": "https://77.88.8.8/dns-query",
  "DomesticDNSIP": "77.88.8.8",
  "Geoipurl": "",
  "Geositeurl": "",
  "LastUpdated": "1760572800",
  "DnsHosts": {},
  "RouteOrder": "block-proxy-direct",
  "DirectSites": [],
  "DirectIp": ["geoip:private"],
  "ProxySites": ["domain:github.com", "domain:githubusercontent.com"],
  "ProxyIp": ["140.82.112.0/20", "185.199.108.0/22", "2606:50c0::/32"],
  "BlockSites": [],
  "BlockIp": [],
  "DomainStrategy": "IPIfNonMatch",
  "FakeDNS": "false"
}

What the fields mean, per the Happ documentation:

NetRoute popup after scanning github.com: the selected format and the result on the Routes tab NetRoute popup after scanning github.com: the selected format and the result on the Routes tab
The NetRoute popup with the “Happ” format: the Routes tab holds the routing profile that remains to be encoded into a link. Scan data: a github.com page.

What you need

Step 1. Generate the profile in NetRoute

  1. Open the website in Chrome and reload the page so the extension’s sniffer sees the background requests
  2. Start NetRoute
  3. Under Target OS pick Happ — the “Proxy clients” group
  4. The Gateway IP and Device fields do not affect this format
  5. Click Analyze website
  6. On the Domains tab untick what you do not need — counters, ad networks, third-party CDNs; the profile updates at once
  7. Click Download: the file is named after the site, for example github_com_rules.json

Step 2. Build the happ://routing/… link

Per the Happ documentation a profile is added with a link in which {base64} is the JSON profile converted to base64 text:

Encode the downloaded file:

# Windows, PowerShell
[Convert]::ToBase64String([IO.File]::ReadAllBytes("github_com_rules.json"))

# macOS
base64 -i github_com_rules.json

# Linux
base64 -w0 github_com_rules.json

Prepend happ://routing/onadd/ to the result — one line, no spaces or line breaks. The link gets long; that is normal.

Encode the file locally — an online encoder would see your list of sites. A built-in “Copy as a Happ link” button in NetRoute is planned.

Step 3. Add the link to Happ

Per the Happ documentation links are accepted in three ways — copied from the clipboard, scanned from a QR code and as a deeplink:

  1. Copy the built link to the clipboard
  2. Open Happ and tap + in the upper-right corner of the main screen
  3. Add the link from the clipboard. To a phone the link is easiest to pass as a QR code or to open as a deeplink — the system offers to open it in Happ
  4. With onadd the profile is already active; with add select it in the list of routing profiles
  5. Reconnect: per the documentation profile changes apply after Reconnect

Step 4. Check

Open the site the profile was built for — it should open through the proxy, while other sites go direct (GlobalProxy: false). If it is the other way round, check which routing profile is active in Happ and that you reconnected after the import.

Common problems

The link is not accepted

Check that the base64 is a single line without breaks (on Linux that needs the -w0 switch) and that it is preceded by exactly happ://routing/onadd/ or happ://routing/add/.

The profile was added but nothing changed

Happ applies a changed profile on reconnect. With an add link the profile also has to be selected as active.

The site pulls data from other domains

They should be visible on the Domains tab in NetRoute — the extension collects domains from the page and from its background requests. Walk through the site before scanning (sign in, open a video) so the deferred requests end up in the profile too. Several sites in one profile — the URL list button next to the analyze button: the file is named bulk_N_rules.json.

A profile in a subscription

Per the Happ documentation a JSON subscription may carry strictly 0 or 1 routing profile, and a profile link can be passed in the routing header or right in the subscription body — handy when you hand out settings to several devices.

DNS and leaks

The profile sets two DNS servers: RemoteDNS for the sites behind the proxy and DomesticDNS for the rest — both over DNS-over-HTTPS (Cloudflare and Yandex in NetRoute’s file). Change them in the JSON before encoding if you need other resolvers. The browser’s queries still go wherever its own DNS is configured: in Chrome turn off “Use secure DNS” or point it at a resolver you trust, otherwise Chrome resolves names past the client.

Check: dnsleaktest.com with Happ on should show the resolver from the profile, not the ISP’s.

Example Configuration File

Ready-to-edit template. Replace the example domains and networks with output from NetRoute for your target sites.


{
  "Name": "NetRoute github.com",
  "GlobalProxy": "false",
  "RemoteDNSType": "DoH",
  "RemoteDNSDomain": "https://1.1.1.1/dns-query",
  "RemoteDNSIP": "1.1.1.1",
  "DomesticDNSType": "DoH",
  "DomesticDNSDomain": "https://77.88.8.8/dns-query",
  "DomesticDNSIP": "77.88.8.8",
  "Geoipurl": "",
  "Geositeurl": "",
  "LastUpdated": "1760572800",
  "DnsHosts": {},
  "RouteOrder": "block-proxy-direct",
  "DirectSites": [],
  "DirectIp": [
    "geoip:private"
  ],
  "ProxySites": [
    "domain:avatars.githubusercontent.com",
    "domain:github.com",
    "domain:github.githubassets.com"
  ],
  "ProxyIp": [
    "140.82.112.0/20",
    "185.199.108.0/22",
    "2606:50c0::/32"
  ],
  "BlockSites": [],
  "BlockIp": [],
  "DomainStrategy": "IPIfNonMatch",
  "FakeDNS": "false"
}

Hint: the text formats download with a comment header. Untick “Include comments in exported files” in the NetRoute options to get the rules alone; the JSON formats never carry comments.

All example configs on GitHub →

Official Documentation

Ready to try?

NetRoute — a free Chrome extension to generate routes from any website.

Install Extension