Welcome! Log In Create A New Profile

Advanced

return 403 instead of next phase

Donatas Abraitis
August 25, 2014 10:08AM
Hey,

static ngx_int_t ngx_http_hostprotect_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cscf;

cscf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cscf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
if(h == NULL)
return NGX_ERROR;

*h = ngx_http_hostprotect_handler;

return NGX_OK;
}

static ngx_int_t ngx_http_hostprotect_handler(ngx_http_request_t *r)
{
...
r->headers_out.status = NGX_HTTP_FORBIDDEN;
r->headers_out.content_length_n = sizeof(err_msg);
ngx_http_send_header(r);
return ngx_http_output_filter(r, &out);
}

Everything looks fine, but backend (in this case Apache) still receives
requests. Any options to drop the request without allowing it to reach
backend?

--
Donatas
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

return 403 instead of next phase

Donatas Abraitis 637 August 25, 2014 10:08AM

Re: return 403 instead of next phase

Maxim Dounin 336 August 25, 2014 12:10PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready