Skip to content

Commit

Permalink
Avoid processing of subrequests initiated by the error_page
Browse files Browse the repository at this point in the history
  • Loading branch information
defanator authored and zimmerle committed Dec 9, 2019
1 parent 485f061 commit 1066675
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ngx_http_modsecurity_header_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)

/* XXX: if NOT_MODIFIED, do we need to process it at all? see xslt_header_filter() */

if (r->error_page) {
return ngx_http_next_header_filter(r);
}

ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);

dd("header filter, recovering ctx: %p", ctx);
Expand Down
4 changes: 4 additions & 0 deletions src/ngx_http_modsecurity_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

if (r->error_page) {
return NGX_OK;
}

dd("catching a new _log_ phase handler");

mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
Expand Down
4 changes: 4 additions & 0 deletions src/ngx_http_modsecurity_pre_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

if (r->error_page) {
return NGX_DECLINED;
}

dd("catching a new _preaccess_ phase handler");

mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
Expand Down
4 changes: 4 additions & 0 deletions src/ngx_http_modsecurity_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

if (r->error_page) {
return NGX_DECLINED;
}

mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf == NULL || mcf->enable != 1) {
dd("ModSecurity not enabled... returning");
Expand Down

0 comments on commit 1066675

Please sign in to comment.