Skip to content

Commit

Permalink
attempt to fix issue238
Browse files Browse the repository at this point in the history
this one is not entirely correct as it produces a set of
"header already sent" alerts in tests (in particular, modsecurity.t,
modsecurity-response-body.t, modsecurity-proxy.t)
  • Loading branch information
defanator committed Jan 25, 2021
1 parent 3dbe4da commit 51cbaf3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ngx_http_modsecurity_header_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,12 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
ret = ngx_http_modsecurity_process_intervention(ctx->modsec_transaction, r);
if (r->error_page) {
return ngx_http_next_header_filter(r);
}
}
if (ret > 0) {
if (!r->header_sent && ret == NGX_HTTP_FORBIDDEN) {
r->err_status = ret;
return ngx_http_send_header(r);
}
return ret;
}

Expand Down

0 comments on commit 51cbaf3

Please sign in to comment.