Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apache2/apache2_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ apr_status_t send_error_bucket(modsec_rec *msr, ap_filter_t *f, int status) {

/* Set the status line explicitly for the error document */
f->r->status_line = ap_get_status_line(status);
f->r->status = 200;
Comment on lines 33 to +35
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting f->r->status = 200 while also setting status_line to an error status and sending an error bucket makes the request status inconsistent with the intended error response. In particular, protocols like HTTP/2 rely on r->status (not status_line) to populate :status, which can cause intercepted/blocked responses to be sent as 200 OK. Align r->status with the status argument (or avoid overriding it here and let the error bucket handling set it), so the final response code matches the interception status and ErrorDocument processing works correctly.

Suggested change
/* Set the status line explicitly for the error document */
f->r->status_line = ap_get_status_line(status);
f->r->status = 200;
/* Set the status explicitly for the error document */
f->r->status_line = ap_get_status_line(status);
f->r->status = status;

Copilot uses AI. Check for mistakes.

brigade = apr_brigade_create(f->r->pool, f->r->connection->bucket_alloc);
if (brigade == NULL) return APR_EGENERAL;
Expand Down
Loading