From d0142d945fd7241d158a7c279f377584d3e45d53 Mon Sep 17 00:00:00 2001 From: Ngo The Trung Date: Wed, 28 Oct 2015 14:45:02 +0800 Subject: [PATCH] Use nginx's parsed hostname --- nginx/modsecurity/ngx_http_modsecurity.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index 7c1395315b..42fe93170c 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -265,7 +265,8 @@ ngx_http_modsecurity_load_request(ngx_http_request_t *r) // req->parsed_uri.user = (char *)ngx_pstrdup0(r->pool, &r->headers_in.user); req->parsed_uri.fragment = (char *)ngx_pstrdup0(r->pool, &r->exten); - req->hostname = (char *)ngx_pstrdup0(r->pool, (ngx_str_t *)&ngx_cycle->hostname); + req->hostname = (char *)ngx_pstrdup0(r->pool, &r->headers_in.server); + req->header_only = r->header_only ? r->header_only : (r->method == NGX_HTTP_HEAD);