For readers who can use a client but are checking the core's JSON config for the first time. Using a V2Fly V4-style config, this guide covers two proxy inbounds that listen only on the local machine and two outbounds. Follow tags to trace a request and distinguish startup failures from routing mistakes and DNS issues.
Top-level structure: objects vs. arrays
The core config's outermost level is a JSON object. inbounds and outbounds are arrays because a process can have multiple inbounds and outbounds. log, routing, and dns are objects, while routing.rules is an array. The order of top-level fields in the file does not determine where traffic goes first, but the order of rules and outbounds can affect the result.
- First, check which config is in use. A subscription link, a client's own settings file, and the JSON loaded by the core are three different things. Successfully importing a subscription only means the client recognized its contents; it does not mean a manually edited config is active.
- Next, check which core is running. v2rayN can use different cores depending on its configuration. The same option in the interface may produce different fields. This guide covers V2Fly's V4-style structure; don't copy Xray-specific fields directly.
Inbounds and outbounds: protocols define their roles
For an inbound, listen and port specify where the core accepts local requests, while protocol determines the proxy type the app should use to connect. For an outbound, protocol determines how requests are handled. The protocols on each side don't have to match. The ports below are examples, not fixed software defaults or remote server ports.
Local SOCKS inbound
- listen
127.0.0.1- port
10808- protocol
socks- tag
local-socks
Select SOCKS5 in the app; this listen address and port are not an HTTP proxy endpoint.
Direct outbound
- protocol
freedom- tag
direct- settings.domainStrategy
AsIs
The core connects directly to the destination; this does not mean the app bypasses the local inbound.
Troubleshooting: check the proxy type, then the port
A local port accepting a TCP connection only means a program is listening. If the app sends HTTP proxy requests to a SOCKS inbound, correct the proxy type and port in the app first—don't change the outbound rules.
Routing: follow tags to find the outbound
This example uses blackhole for requests to the reserved test domain example.test and freedom for requests that don't match. There is no remote proxy node, and the test domain doesn't need a working DNS record: the exact-domain rule can match as long as the inbound request contains that domain. To test a direct connection, use a destination you can reach.
{
"log": { "loglevel": "warning" },
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10808,
"protocol": "socks",
"tag": "local-socks",
"settings": { "auth": "noauth", "udp": false }
},
{
"listen": "127.0.0.1",
"port": 10809,
"protocol": "http",
"tag": "local-http",
"settings": {}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct",
"settings": { "domainStrategy": "AsIs" }
},
{
"protocol": "blackhole",
"tag": "blocked",
"settings": {}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"domain": ["full:example.test"],
"outboundTag": "blocked"
}
]
}
}
- Rules are checked in array order. The first matching rule determines the outbound. If you add a broader rule, check that it doesn't come before a more specific one.
full:example.testmatches that exact domain, not its subdomains. - No match doesn't mean automatic rejection. With no other fallback rule configured, unmatched requests go to the first item in
outbounds,direct. If you swap the two outbounds, the rule can still findblockedby its tag, but unmatched requests will also use the first item and be blocked. - Inbounds and outbounds use different fields for references.
outboundTagis a single string that references an outbound'stag. To limit the rule above to the HTTP inbound, add"inboundTag": ["local-http"]to the same rule; both the inbound tag and domain condition must then match.
DNS: separate routing lookups from outbound lookups
dns configures the resolver the core can use; it does not change the system DNS for the entire computer. routing.domainStrategy determines whether routing looks up an IP address to match a domain, while freedom's settings.domainStrategy determines how that outbound handles domains. The fields have the same name but belong to different levels; changing one does not change the other.
| Field | Example setting | What it does |
|---|---|---|
dns.servers | ["localhost"] | Sets the resolver source for the built-in DNS; this example uses the local system resolver. |
routing.domainStrategy | IPIfNonMatch | If no domain rule matches, try resolving the destination domain and match by IP. |
freedom's settings.domainStrategy | AsIs | The direct outbound does not proactively use built-in DNS to resolve domains to IP addresses; the system may still resolve the domain when connecting. |
The complete example above uses AsIs for routing, which is enough to match the original domain received by the core. If the app resolves the domain before connecting to the SOCKS inbound and sends only the destination IP, the domain rule has no domain to match. To test this rule, configure the app to pass the domain to the proxy; adding dns.servers alone won't restore the original domain from an IP address.
Logs: troubleshoot by failure stage
With log.loglevel set to warning, routine logs focus on warnings and errors. To troubleshoot a single request, temporarily switch to info, or debug if needed, then restore the original value after recording what changed. Compare the logs against the request time, and remove unnecessary destination addresses, account identifiers, and subscription details before sharing them.
- The core won't start: First check whether the JSON can be parsed. This example uses standard JSON: put keys and strings in double quotes, with no comments or trailing commas. Once the syntax is valid, check field nesting, protocol names, and whether the current core supports that configuration.
- The core starts, but the app can't connect: Confirm that the core loaded the config you just edited, and check whether the current process is listening on
127.0.0.1:10808and127.0.0.1:10809. If another program is using a port, switch to an available one and update the app's proxy settings to match. - The request reaches the core, but the result is wrong: First check whether the core received a domain or an IP address. Then find the first matching rule in order and confirm that
outboundTagpoints to the expected outbound. Ifdirectwas selected but the connection still fails, check DNS resolution and destination reachability; not every timeout is a routing issue.
When reviewing the config, change one field at a time and repeat the same request. This makes it easier to tell whether the app has started using the correct port or was connecting all along but selecting the wrong outbound.