Coraza WAF: a Go ModSecurity-compatible engine for embedding in your own stack
OWASP Coraza WAF is a golang modsecurity compatible web application firewall library
At a glance
- What is it?
- Coraza is an OWASP production project that runs OWASP Core Rule Set v4 rules inside a Go program, with integrations for Caddy, Envoy and HAProxy. It is a library first, so the deployment work is yours.
- Who is it for?
- Adopt Coraza if your code is Go, or if you already run Caddy, Envoy or HAProxy and want CRS v4 rules evaluated in-process rather than in a separate reverse proxy. Do not adopt it if you need a finished, config-file-only WAF with a management UI: the core is a library, several integrations are marked experimental or in need of a maintainer, and the C library for nginx is experimental.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- corazawaf/coraza4,024 ★ · +184
| Repository | 2026-09-24 | 2026-11-15 |
|---|---|---|
| corazawaf/coraza | 3.8k | 4k |
184 Stars in the last 52 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What Coraza actually solves, and for whom
Most WAF deployments put a separate process in front of the application. Coraza inverts that. The README describes it as "a library at its core", written in Go, that supports ModSecurity SecLang rulesets and is "100% compatible with the OWASP Core Rule Set v4". If your service is already Go, you can evaluate WAF rules inside the same binary that serves traffic, with no extra network hop and no second configuration language to keep in sync.
The audience is therefore narrower than a commercial WAF's. It is Go developers who want request inspection woven into an existing middleware chain, and operators of Caddy, Envoy or Traefik who would rather attach a plugin than run a standalone appliance. Anyone who wants a dashboard, a policy editor and a support contract is not the target reader of this repository.
The transaction model: how a request is inspected
Coraza's unit of work is the transaction. You build a WAF from a configuration, create a transaction from it, feed it connection and request data phase by phase, and check whether any phase returned an interruption. The README's core example shows exactly that sequence: NewWAF with WithDirectives, waf.NewTransaction(), tx.ProcessConnection, then tx.ProcessRequestHeaders, whose return value is an interruption carrying a Status when a rule fired. Cleanup is explicit: tx.ProcessLogging() followed by tx.Close().
Rules come in as SecLang text. In the sample, the directive is a single SecRule on REMOTE_ADDR with a deny action and status 403. In production you would load the Core Rule Set instead, which the README says covers SQL injection, cross site scripting, PHP and Java code injection, HTTPoxy, Shellshock, and scanner or bot detection.
Two mechanics are worth knowing before you deploy. First, compiled regex and aho-corasick builders are memoized by default in a global cache shared across WAF instances, which the README says reduces memory consumption and startup overhead; in long-lived processes that reload rules, it directs you to WAF.Close() via experimental.WAFCloser to release cached entries, or to the coraza.no_memoize build tag to opt out. Second, several behaviours are controlled by build tags, and the README states these "do not have compatibility guarantees across minor versions". The coraza.rule.multiphase_evaluation tag makes rule variables evaluate in whichever phase they become ready rather than only the phase the rule is defined for. The coraza.rule.case_sensitive_args_keys and coraza.rule.no_regex_multiline tags are both described as becoming default in the next major version, so opting in now means your rule behaviour will change shape later unless you track that.
Installing Coraza and running a first rule in Go
Coraza is consumed as a Go module, github.com/corazawaf/coraza/v3. The prerequisites section asks for a recent Go version (see go.mod) or the tinygo compiler, on Linux (Debian or Centos recommended), Windows or Mac. The go.mod in the repository declares go 1.25.0, so a toolchain at or above that line is the safe assumption.
Add the dependency to an existing module:
go get github.com/corazawaf/coraza/v3Then the smallest program that actually inspects a request follows the README's example. Note that the error from NewWAF is checked before the transaction is created:
package main
import (
"fmt"
"github.com/corazawaf/coraza/v3"
)
func main() {
waf, err := coraza.NewWAF(coraza.NewWAFConfig().
WithDirectives(`SecRule REMOTE_ADDR "@rx .*" "id:1,phase:1,deny,status:403"`))
if err != nil {
fmt.Println(err)
}
tx := waf.NewTransaction()
defer func() {
tx.ProcessLogging()
tx.Close()
}()
tx.ProcessConnection("127.0.0.1", 8080, "127.0.0.1", 12345)
if it := tx.ProcessRequestHeaders(); it != nil {
fmt.Printf("Transaction was interrupted with status %d\n", it.Status)
}
}That directive matches every remote address, so every request should be interrupted with status 403. Seeing that line printed is the confirmation that the parser, the rule engine and the transaction lifecycle are all wired correctly. The repository also ships examples/http-server, which the README points to as the place to practice with a working server rather than a bare transaction.
For a more realistic rule set, the module depends on github.com/corazawaf/coraza-coreruleset, which is how the CRS v4 rules are pulled in. The README does not spell out the loading call in the excerpt above, so check the examples directory and the project documentation site for the current directive-loading pattern before assuming an API name.
Where Coraza is the wrong tool
The integration list is the honest part of this project, and it should shape your decision more than the feature bullets do. Caddy is described as stable but "needs a maintainer". The Proxy WASM extension for Envoy is stable and "still under development". The Traefik WASM extension is experimental and also "needs a maintainer". HAProxy SPOE is experimental. The C library intended for nginx and similar servers is experimental. RuiQi, a web management panel for the SPOA path, is experimental.
Read that as a maintenance signal: if your plan is nginx, or a Traefik deployment without a Go developer on hand, you are building on an experimental integration. The core library is the mature artifact; the edges are not equally settled.
There is a second boundary. Coraza is a WAF engine, not a proxy. It does not terminate TLS, balance load, or serve static files. It inspects what you hand it. If you want a self-contained reverse proxy that happens to include a WAF, Coraza is a component you would have to assemble, and the assembly is your code to maintain.
A third constraint is rule compatibility. The README states plainly that older versions of the CRS are not compatible, only v4. If your rule estate is a hand-edited SecLang file from years ago, expect to rewrite parts of it, and expect the build tags above to shift some matching semantics under you across minor versions.
Coraza versus ModSecurity, and versus a hosted WAF
The comparison the README invites is with ModSecurity. Coraza calls itself "an alternative engine that has partial compatibility" with the OWASP ModSecurity engine and supports industry-standard SecLang rule sets. The practical difference is the host language and the deployment shape: ModSecurity is a C++ engine typically attached to Apache or nginx as a module, while Coraza is a Go library you import. That matters for build tooling, for how you ship the artifact, and for whether you can unit-test rule behaviour inside your normal Go test suite. It also matters for rule parity: partial compatibility is the phrase used, so a rule set that leans on ModSecurity features outside the supported surface is a migration risk rather than a drop-in swap. The Coraza Playground is offered for rule testing, which is the reasonable way to find those gaps before a cutover.
Against a hosted WAF such as Cloudflare's, the difference is not rule quality but control and topology. A hosted WAF sits at the edge, in front of your origin, and you configure it through a vendor interface. Coraza runs wherever your Go binary runs, including inside a private network with no edge provider, and your rules live in your repository. The trade is operational: you own the rule updates, the false-positive tuning and the upgrade cadence. The project publishes benchmarks on its documentation site, but the README's performance claim is unquantified, so treat throughput as something to measure against your own rule set rather than something to assume.
Maintenance, licence and upgrade cost
The repository is not archived and the last push was on 2026-09-22, so this is a codebase receiving current commits. Releases are frequent: v3.5.0 on 2026-03-28, v3.6.0 on 2026-03-31 and v3.7.0 on 2026-04-06, three minor versions inside ten days. That cadence is good for fixes and awkward for anyone who pins versions loosely.
The upgrade cost concentrates in the build tags. The README says they are "for advanced use cases only" and carry no compatibility guarantees across minor versions. Two of them, coraza.rule.case_sensitive_args_keys and coraza.rule.no_regex_multiline, are documented as becoming default in the next major version. If you enable either today, your matching behaviour changes when that major lands, and the README notes the case-sensitivity change aligns ARGS key matching with RFC 3986 while the multiline change aligns with CRS expectations and may reduce false positives. Plan a rule-set regression run around that upgrade, not just a dependency bump. The go.mod also carries a retract v3.2.2 directive, a reminder that this project does withdraw versions.
Licensing is Apache-2.0, which permits commercial and closed-source use and includes an explicit patent grant. That is a permissive licence, and it is compatible with the way most teams embed a library. It is not legal advice, and the one thing worth confirming with your own counsel is the licence of the rule set you load: the CRS is a separate project from this engine, and the Apache-2.0 grant here covers Coraza's code, not third-party rules you bundle.
Editorial conclusion
Adopt Coraza if your code is Go, or if you already run Caddy, Envoy or HAProxy and want CRS v4 rules evaluated in-process rather than in a separate reverse proxy. Do not adopt it if you need a finished, config-file-only WAF with a management UI: the core is a library, several integrations are marked experimental or in need of a maintainer, and the C library for nginx is experimental. Verify first that your rule set is CRS v4, since the README states older CRS versions are not compatible, and check the go.mod Go version against your toolchain.
Frequently asked questions
What is Coraza WAF?
It is an open source web application firewall written in Go, distributed as the library github.com/corazawaf/coraza/v3. The README describes it as supporting ModSecurity SecLang rulesets and being 100% compatible with the OWASP Core Rule Set v4.
How does Coraza compare with ModSecurity?
The README calls Coraza an alternative engine with partial compatibility with the OWASP ModSecurity engine, supporting industry-standard SecLang rule sets. The main structural difference is that Coraza is a Go library you embed, while ModSecurity is typically deployed as a module attached to a web server.
What does Coraza do with a request?
It builds a WAF from directives, creates a transaction, feeds it connection and request data phase by phase, and returns an interruption with a status code when a rule fires. The README's example calls ProcessConnection and ProcessRequestHeaders, then ProcessLogging and Close for cleanup.
What is Coraza WAF compared with ModSecurity in general terms?
The README positions Coraza as an alternative engine with partial compatibility with the OWASP ModSecurity engine, running industry-standard SecLang rule sets and OWASP CRS v4. It is a Go library rather than a web server module.
What is Coraza?
In this project's context, Coraza is an OWASP production project: a Go web application firewall library that parses SecLang rules and runs the OWASP Core Rule Set v4. The README lists integrations for Caddy, Envoy via Proxy WASM, Traefik, HAProxy and a C library for nginx.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/corazawaf-coraza)Star history chart for your README
[](https://hysenlabs.com/projects/corazawaf-coraza)Was this useful?