Skip to content

feat: add waf bypass prevention rule #337

Description

@alehostert

Static Badge

We could have a toggle to add a WAF Bypass Prevention nginx rule for major companies, like NOC.org, Sucuri, Akamai, etc.

I have this code block working fine with NOC:

# WAF Bypass Prevention
# With WebSockets support
set $bypass_attempt "deny";

if ($http_upgrade ~* websocket)                                 { set $bypass_attempt "allow"; } # WebSocket handshake
if ($request_uri ~ ^/(ws|websocket)/)                           { set $bypass_attempt "allow"; } # General WebSocket
if ($request_uri ~ /socket\.io/.*transport=(polling|websocket)) { set $bypass_attempt "allow"; } # Socket.IO

if ($http_x_real_ip = "")        { set $bypass_attempt "${bypass_attempt}_1"; }
if ($http_noc_cdn_location = "") { set $bypass_attempt "${bypass_attempt}_2"; }

if ($bypass_attempt = "deny_1")   { return 403; }
if ($bypass_attempt = "deny_2")   { return 403; }
if ($bypass_attempt = "deny_1_2") { return 403; }

Just adding this to location / on /app/conf/nginx/mapping/primary.conf works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions