Files
masyunis/internal/ja4h.go
T
sol_bot Bot e07de898cd Import Anubis v1.28.2
Replace the tree with upstream TecharoHQ/anubis v1.28.2 (a1384fbf42e3).
Masyunis customizations are re-applied in the following commits.
2026-11-28 14:52:26 +03:00

21 lines
612 B
Go

package internal
import (
"net/http"
"github.com/lum8rjack/go-ja4h"
)
// JA4HHeaderName is the name of the HTTP header that the [JA4H] middleware adds
// to requests, holding the request's JA4H fingerprint. It is also used to
// detect whether a policy references the fingerprint, so that the relatively
// expensive computation can be skipped when no rule needs it.
const JA4HHeaderName = "X-Http-Fingerprint-Ja4h"
func JA4H(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Header.Set(JA4HHeaderName, ja4h.JA4H(r))
next.ServeHTTP(w, r)
})
}