Skip to content
Security Hardening

Security Hardening

Combine naati’s memory-safe Goose parser core with standard NGINX traffic controls to defend edge services against abuse and DoS.

Rate Limiting & Connection Caps

http {
    limit_req_zone  $binary_remote_addr zone=api_rate:20m rate=20r/s;
    limit_conn_zone $binary_remote_addr zone=per_ip_conn:10m;

    server {
        listen 443 ssl;
        http2 on;

        limit_conn per_ip_conn 50;
        limit_conn_status 429;

        location /api/ {
            limit_req zone=api_rate burst=40 nodelay;
            limit_req_status 429;
            proxy_pass http://app_backend;
        }
    }
}

Bounded Request Sizes & Timeouts

Keep slowloris and oversized header/body attacks bounded tightly at the edge:

client_body_timeout    15s;
client_header_timeout  15s;
send_timeout           30s;
keepalive_timeout      65s;
client_max_body_size   10m;
large_client_header_buffers 4 8k;
server_tokens off;

External Auth Gate (auth_request)

Delegate token or session checks to an internal auth service before forwarding traffic:

location /private/ {
    auth_request /_auth;
    auth_request_set $auth_user $upstream_http_x_auth_user;
    proxy_set_header X-Auth-User $auth_user;
    proxy_pass http://app_backend;
}

location = /_auth {
    internal;
    proxy_pass http://127.0.0.1:8090/verify;
    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
    proxy_set_header X-Original-URI $request_uri;
}