diff --git a/attachments/nginx/ngx_module/ngx_cp_hook_threads.h b/attachments/nginx/ngx_module/ngx_cp_hook_threads.h index 2c29df1..5043ffc 100644 --- a/attachments/nginx/ngx_module/ngx_cp_hook_threads.h +++ b/attachments/nginx/ngx_module/ngx_cp_hook_threads.h @@ -44,6 +44,7 @@ struct ngx_http_cp_event_thread_ctx_t int should_return_next_filter; ngx_http_cp_modification_list *modifications; ///< Context's modification. + ngx_str_t waf_tag; ///< WAF tag value for the location block. }; /// diff --git a/attachments/nginx/ngx_module/ngx_cp_hooks.c b/attachments/nginx/ngx_module/ngx_cp_hooks.c index b47c61b..adeed25 100644 --- a/attachments/nginx/ngx_module/ngx_cp_hooks.c +++ b/attachments/nginx/ngx_module/ngx_cp_hooks.c @@ -440,6 +440,12 @@ ngx_http_cp_req_header_handler(ngx_http_request_t *request) return NGX_DECLINED; } + conf = ngx_http_get_module_loc_conf(request, ngx_http_cp_attachment_module); + if (conf == NULL) { + write_dbg(DBG_LEVEL_WARNING, "Failed to get module configuration"); + return NGX_DECLINED; + } + session_data_p = init_cp_session_data(request); if (session_data_p == NULL) return NGX_DECLINED; @@ -447,6 +453,7 @@ ngx_http_cp_req_header_handler(ngx_http_request_t *request) write_dbg(DBG_LEVEL_DEBUG, "Request header filter handling session ID: %d", session_data_p->session_id); init_thread_ctx(&ctx, request, session_data_p, NULL); + ctx.waf_tag = conf->waf_tag; sessions_per_minute_verdict = enforce_sessions_rate(); if (sessions_per_minute_verdict != TRAFFIC_VERDICT_INSPECT) {