Skip to content

coraza-proxy-wasm support  #454

@ivanitskiy

Description

@ivanitskiy

I was trying to see if https://github.com/corazawaf/coraza-proxy-wasm would work with this module.

a wasm module can be downloaded from: https://github.com/corazawaf/coraza-proxy-wasm/releases/download/0.4.0/coraza-proxy-wasm-0.4.0.zip

error.log file:

2023/11/30 12:10:01 [error] 63932#0: *1 [wasm] error while executing at wasm backtrace:
    0: 0x1db40d - <unknown>!(*github.com/corazawaf/coraza-proxy-wasm/wasmplugin.wafMetrics).incrementCounter
    1: 0x1d98ea - <unknown>!proxy_on_request_headers
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    host trap (function not yet implemented): proxy_define_metric <module: "coraza", vm: "main", runtime: "wasmtime">

Creating this issue to track completeness and compatibility with a more complicated proxy-wasm filter such as coraza-proxy-wasm.

nginx config:

daemon off;
worker_processes  auto;
master_process    off;

events {
    worker_connections  2048;
}

wasm {
    module coraza coraza-proxy-wasm.wasm;
}

http {
    server {
        listen 9000;

        location / {
            proxy_wasm coraza;
            proxy_pass http://127.0.0.1:8000/;
        }
    }

    server {
        listen 8000;
        location / {
            return 200 "Hello, World!";
        }
    }
}

sending a request to nginx:

curl -v localhost:9000
*   Trying 127.0.0.1:9000...
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET / HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/8.1.2
> Accept: */*
> 
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/html
< Content-Length: 177
< Connection: close
< Server: nginx/1.25.3
< Date: Thu, 30 Nov 2023 20:10:01 GMT
< 
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.25.3</center>
</body>
</html>
* Closing connection 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions