Skip to content

Commit

Permalink
Merge pull request #23 from anuraaga/clean-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
jptosso authored Sep 30, 2022
2 parents a396fcc + 2324cc9 commit 7063a54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion coraza.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ func (m *Coraza) Validate() error {
func (m Coraza) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
var err error
tx := m.waf.NewTransaction(context.Background())
defer tx.ProcessLogging()
defer func() {
tx.ProcessLogging()
_ = tx.Clean()
}()
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
repl.Set("http.transaction_id", tx.ID)

Expand Down

0 comments on commit 7063a54

Please sign in to comment.