hiddify.st
EN

TopicRouting

No proxy, just a split handshake

Among the outbounds of Hiddify routing rules is “Direct with fragment”: traffic skips the proxy, and only the TLS handshake is split before being sent directly, for sites blocked by SNI whose IP is not blocked. This article covers how it works, where it helps, the TLS tricks settings and the setup steps.

Checked on

Scattered jigsaw pieces: fragmenting breaks one whole “business card” into many small pieces
Scattered jigsaw pieces: fragmenting breaks one whole “business card” into many small pieces Profpcde, CC0

When choosing Outbound if match in the rule editor, besides proxy, direct and block there is “Direct with fragment”. It is rarely mentioned, yet in the right situation it saves a lot of proxy traffic: some sites are not fully blocked at all, only recognised by name at the moment of the handshake.

“Direct with fragment” is the least mentioned of the outbound options, yet for some sites it saves a lot of proxy traffic. The precondition is telling apart whether a site is blocked by its name or by its whole IP. Below, from how it works to settings and limits.

How sites are blocked by name

When you visit an HTTPS site, the browser's first packet is the TLS ClientHello, which has a field called SNI that states the site's name in plain text, such as www.example.com. Nothing is encrypted yet, so passing inspection equipment only has to read the SNI to know where you are going, and cut the connection if it disapproves.

This is called SNI-based blocking. Its mark: the site's IP itself is reachable; the connection is stopped only once the name is given.

Strips from a paper shredder: cut small enough, a passer-by cannot read the whole word
Strips from a paper shredder: cut small enough, a passer-by cannot read the whole word Ajay Suresh from New York, NY, USA, CC BY 2.0

Why fragmenting gets through

Inspection equipment handles enormous amounts of traffic, so it usually checks only the first packet or two of a connection, and does not always reassemble split TCP data before looking. Split the ClientHello into many small pieces sent as separate packets, and the SNI is cut across several packets; the equipment cannot read the whole name and often lets it pass. The site's server reassembles normally, so the site is unaffected.

“Direct with fragment” means: this connection skips the proxy and goes straight to the site, but the handshake is split using the settings under Settings → TLS tricks.

Compared with using the proxy

Through the proxyDirect with fragment
Uses subscription trafficYesNo
SpeedLimited by the proxy serverSame as direct
IP the site seesThe proxy'sYour own
Beats IP blockingYesNo
Beats SNI blockingYesUsually

The TLS tricks settings

SettingMeaningTo start
Fragmentation packetsWhich part to split: TLS Hello, or 1-1 to 1-5TLS Hello
Fragment sizeBytes per piece, can be a rangeDefault, or 10-30
Fragment sleepMilliseconds between piecesDefault, or 2-8
Mixed SNI caseMixes upper and lower case in the site nameOff at first
PaddingAdds padding data to the handshakeOff at first

Smaller pieces and longer gaps are harder to recognise but make the handshake slower. Start with the defaults and adjust bit by bit if needed.

Shipping cartons strapped and stacked: one shipment split into many small parcels, sent separately to the same address
Shipping cartons strapped and stacked: one shipment split into many small parcels, sent separately to the same address Bob Jenkins, CC BY 2.0

Setup steps

  1. Sort the site listUse the rule sorter in the lab, outbound “Direct with fragment”
  2. Settings → Routing → Add ruleName it “Fragment direct”
  3. Outbound if matchChoose “Direct with fragment”
  4. Paste into Domain suffixOne per line
  5. Save and reconnectOpen a site from the list
Adding direct with fragment for a few sites

If the site opens, it was blocked only by SNI, and visiting it no longer uses proxy traffic. If not, its IP is blocked too; change the rule's outbound back to Proxy.

Limits

  • TLS only: plain HTTP sites and non-TLS protocols are not affected.
  • Not for QUIC: when a browser visits a site that supports HTTP/3, it uses QUIC over UDP, where there is no TCP fragmenting. Add another rule that blocks QUIC traffic for the same sites, and the browser falls back to TCP.
  • Equipment evolves: equipment that reassembles packets is not fooled, and a site that works today may not tomorrow.
  • The IP is not hidden: your ISP still knows which IP you connect to; it just cannot read the name.

First confirm it is blocked by name

Not every site that will not open suits direct with fragment. A quick way to judge:

SymptomMore likely causeDoes direct with fragment help
Connection reset almost at onceSNI blockingUsually
Spins until it times outIP blocked or packet lossNo
Home page opens, images and video do notSome domains blockedMaybe, for those domains
Certificate errorHijacking or certificate problemNo, and do not continue to the site

If you cannot tell, the fastest way is to add a rule and try: keep it if the site opens, switch back to proxy if not, all within two minutes.

A site is often made of several domains, such as the main site, an image server and a video server. The main site opening with fragment does not mean the image and video domains will too. If a page opens but its content loads only partly, use the network panel in the browser's developer tools to see which requests fail, and add those domains to a proxy rule on their own.

Can I use direct with fragment for every site?

Not a good idea. Sites blocked by IP will not open, and normal sites get slower handshakes. Use it only for sites where it is confirmed to work.

How does this relate to fragment under TLS tricks?

Turn on fragment on the TLS tricks page applies to proxied connections; “Direct with fragment” applies the same settings to direct connections. The settings are shared.

Does it work on Android?

Yes, rules and TLS tricks are available on every platform.

Can anyone tell that direct with fragment is a proxy?

No, because it does not go through a proxy at all. But a handshake split into very small pieces is itself unusual, and a strict network may notice that pattern.