diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index e6b1162a0..b88df336b 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -3507,16 +3507,16 @@ ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) sn->server = cscf; sn->name = value[i]; - ngx_strlow(sn->name.data, sn->name.data, sn->name.len); - if (value[i].data[0] != '~') { + ngx_strlow(sn->name.data, sn->name.data, sn->name.len); continue; } #if (NGX_PCRE) { - ngx_regex_compile_t rc; - u_char errstr[NGX_MAX_CONF_ERRSTR]; + u_char *p; + ngx_regex_compile_t rc; + u_char errstr[NGX_MAX_CONF_ERRSTR]; if (value[i].len == 1) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, @@ -3533,6 +3533,13 @@ ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) rc.err.len = NGX_MAX_CONF_ERRSTR; rc.err.data = errstr; + for (p = value[i].data; p < value[i].data + value[i].len; p++) { + if (*p >= 'A' && *p <= 'Z') { + rc.options = NGX_REGEX_CASELESS; + break; + } + } + sn->regex = ngx_http_regex_compile(cf, &rc); if (sn->regex == NULL) { return NGX_CONF_ERROR;