Skip to content

Commit d92eb94

Browse files
committed
Add log force enable / disable action
1 parent 1a1ea94 commit d92eb94

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ngx_http_redirectionio_module.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ static ngx_int_t ngx_http_redirectionio_log_handler(ngx_http_request_t *r) {
378378
ngx_http_redirectionio_conf_t *conf;
379379
ngx_http_redirectionio_ctx_t *ctx;
380380
ngx_http_redirectionio_log_t *log;
381+
bool should_log;
381382

382383
// Disallow in sub request
383384
if (r != r->main) {
@@ -390,13 +391,15 @@ static ngx_int_t ngx_http_redirectionio_log_handler(ngx_http_request_t *r) {
390391
return NGX_DECLINED;
391392
}
392393

393-
if (conf->enable_logs == NGX_HTTP_REDIRECTIONIO_OFF) {
394+
ctx = ngx_http_get_module_ctx(r, ngx_http_redirectionio_module);
395+
396+
if (ctx == NULL) {
394397
return NGX_DECLINED;
395398
}
396399

397-
ctx = ngx_http_get_module_ctx(r, ngx_http_redirectionio_module);
400+
should_log = redirectionio_action_should_log_request(ctx->action, conf->enable_logs != NGX_HTTP_REDIRECTIONIO_OFF, r->headers_out.status);
398401

399-
if (ctx == NULL) {
402+
if (!should_log) {
400403
return NGX_DECLINED;
401404
}
402405

0 commit comments

Comments
 (0)