<div dir="ltr">Hey,<div><br></div><div><div>static ngx_int_t ngx_http_hostprotect_init(ngx_conf_t *cf)</div><div>{</div><div> ngx_http_handler_pt *h;</div><div> ngx_http_core_main_conf_t *cscf;</div><div><br></div><div> cscf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);</div>
<div> h = ngx_array_push(&cscf->phases[NGX_HTTP_ACCESS_PHASE].handlers);</div><div> if(h == NULL)</div><div> return NGX_ERROR;</div><div><br></div><div> *h = ngx_http_hostprotect_handler;</div><div><br></div>
<div> return NGX_OK;</div><div>}</div><div><br></div><div><div>static ngx_int_t ngx_http_hostprotect_handler(ngx_http_request_t *r)</div><div>{</div></div><div> ...</div><div><div> r->headers_out.status = NGX_HTTP_FORBIDDEN;</div>
<div> r->headers_out.content_length_n = sizeof(err_msg);</div><div> ngx_http_send_header(r);</div><div> return ngx_http_output_filter(r, &out);</div></div><div>}</div><div><br></div><div>Everything looks fine, but backend (in this case Apache) still receives requests. Any options to drop the request without allowing it to reach backend?</div>
<div><br></div>-- <br>Donatas<br>
</div></div>