nginx JA Fingerprint
A dynamic nginx module that provides JA3 and JA4 TLS client fingerprints as variables: for logs, headers to the backend and rules that tell bots and scripts from browsers.
Since
2026
Licence
BSD-2-Clause
load_module modules/ngx_http_tls_ja_module.so;
http {
log_format ja '$remote_addr "$request" '
'ja3=$tls_ja3_hash ja4=$tls_ja4 '
'greased=$tls_greased';
server {
listen 443 ssl;
listen 443 quic reuseport;
http2 on;
access_log /var/log/nginx/access.log ja;
location / {
proxy_set_header X-JA4 $tls_ja4;
proxy_pass http://backend;
}
}
}
Technologies
The Challenge
The client sets its own User-Agent; changing it is one line of code. The TLS ClientHello, on the other hand, shows which TLS library is actually talking, which makes it a useful second signal at the edge. For nginx, that used to mean patching OpenSSL and the nginx core and carrying those patches through every update.
The Solution
The module reads the ClientHello through OpenSSL's public ClientHello API and a message callback, computes JA3 and JA4 once per TLS connection and provides them as $tls_ja3_hash, $tls_ja3, $tls_ja4 and $tls_greased. The values go into the access log, to the backend as headers, or into a map for rate limiting and blocking.
How the module works
Capture
The module wraps nginx's ClientHello callback, including in the servers selected by SNI. The extension list comes from the raw ClientHello in wire order, everything else from the ClientHello API.
Compute
JA3 as defined by Salesforce, JA4 as specified in FoxIO's JA4.md, with signature algorithms in wire order. GREASE values are detected and reported separately as $tls_greased.
Store
The result is attached to the TLS connection and freed with it. All HTTP/3 streams of a QUIC connection share the same TLS connection and therefore the same fingerprint.
A different approach
phuslu/nginx-ssl-fingerprint made JA3 and JA4 in nginx practical in the first place, and it patches OpenSSL and the nginx core to do so. This module takes a different approach: it uses only public OpenSSL interfaces and so works with the distribution's OpenSSL package and its security updates. Extensions that OpenSSL itself doesn't know, such as ALPS and ECH in current Chrome, are included.
Tests
Unit tests with the examples from the specifications and FoxIO's reference captures, and real handshakes with HelloRetryRequest and session resumption. Integration tests with curl, openssl s_client and aioquic over HTTP/3 compare every value with Wireshark. On top of that, runs under ASan and UBSan, and fuzzing with libFuzzer.
Variable names
The variables are deliberately named $tls_* rather than $http_*. nginx silently resolves unknown $http_* names to request headers set by the client. With $tls_*, nginx -t fails when the module isn't loaded.
Use and licence
The module is built with --with-compat against the same nginx version that loads it, and needs OpenSSL 3.5 or later. It implements JA4 for TLS clients from the BSD-licensed part of the specification; the other JA4+ methods are under the FoxIO licence and are not part of the module. The code is on GitHub under BSD-2-Clause.
Results
JA3 and JA4 fingerprints right in nginx, for HTTP/1.1, HTTP/2 and HTTP/3, with the distribution's OpenSSL: a basis for recognising scripted clients at the edge and limiting them selectively.