diff options
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_handler.c')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 669a970d6..e382f05e2 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -81,6 +81,13 @@ static ngx_command_t ngx_http_proxy_commands[] = { offsetof(ngx_http_proxy_loc_conf_t, send_timeout), NULL }, + { ngx_string("proxy_preserve_host"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_proxy_loc_conf_t, preserve_host), + NULL }, + { ngx_string("proxy_set_x_real_ip"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, @@ -774,6 +781,7 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) conf->connect_timeout = NGX_CONF_UNSET; conf->send_timeout = NGX_CONF_UNSET; + conf->preserve_host = NGX_CONF_UNSET; conf->set_x_real_ip = NGX_CONF_UNSET; conf->add_x_forwarded_for = NGX_CONF_UNSET; @@ -816,6 +824,7 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, prev->connect_timeout, 60000); ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000); + ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0); ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0); ngx_conf_merge_value(conf->add_x_forwarded_for, prev->add_x_forwarded_for, 0); @@ -1057,6 +1066,7 @@ static char *ngx_http_proxy_parse_upstream(ngx_str_t *url, } if (u->port_text.data == NULL) { + u->default_port = 1; u->port = htons(80); u->port_text.len = 2; u->port_text.data = "80"; @@ -1087,6 +1097,7 @@ static char *ngx_http_proxy_parse_upstream(ngx_str_t *url, u->uri.len = 1; if (u->port_text.data == NULL) { + u->default_port = 1; u->port = htons(80); u->port_text.len = 2; u->port_text.data = "80"; |