Index: modules/proxy/mod_proxy.c =================================================================== --- modules/proxy/mod_proxy.c (revision 1891226) +++ modules/proxy/mod_proxy.c (working copy) @@ -1888,8 +1888,16 @@ static const char * new->balancer = balancer; } else { - proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, new->real); int reuse = 0; + proxy_worker *worker; + if (use_regex) { + worker = ap_proxy_get_match_worker(cmd->temp_pool, NULL, + conf, new->real); + } + else { + worker = ap_proxy_get_worker(cmd->temp_pool, NULL, + conf, new->real); + } if (!worker) { const char *err; if (use_regex) { @@ -2671,8 +2679,16 @@ static const char *proxysection(cmd_parms *cmd, vo } } else { - worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf, - ap_proxy_de_socketfy(cmd->temp_pool, (char*)conf->p)); + if (use_regex) { + worker = ap_proxy_get_match_worker(cmd->temp_pool, NULL, sconf, + ap_proxy_de_socketfy(cmd->temp_pool, + (char*)conf->p)); + } + else { + worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf, + ap_proxy_de_socketfy(cmd->temp_pool, + (char*)conf->p)); + } if (!worker) { if (use_regex) { err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL, Index: modules/proxy/mod_proxy.h =================================================================== --- modules/proxy/mod_proxy.h (revision 1891226) +++ modules/proxy/mod_proxy.h (working copy) @@ -754,7 +754,20 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker( proxy_balancer *balancer, proxy_server_conf *conf, const char *url); + /** + * Get the matchable worker from proxy configuration + * @param p memory pool used for finding worker + * @param balancer the balancer that the worker belongs to + * @param conf current proxy server configuration + * @param url url to find the worker from + * @return proxy_worker or NULL if not found + */ +PROXY_DECLARE(proxy_worker *) ap_proxy_get_match_worker(apr_pool_t *p, + proxy_balancer *balancer, + proxy_server_conf *conf, + const char *url); + /** * Define and Allocate space for the worker to proxy configuration * @param p memory pool to allocate worker from * @param worker the new worker Index: modules/proxy/proxy_util.c =================================================================== --- modules/proxy/proxy_util.c (revision 1891226) +++ modules/proxy/proxy_util.c (working copy) @@ -1720,10 +1720,11 @@ static int ap_proxy_strcmp_ematch(const char *str, return 0; } -PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p, - proxy_balancer *balancer, - proxy_server_conf *conf, - const char *url) +static proxy_worker *proxy_get_worker(apr_pool_t *p, + proxy_balancer *balancer, + proxy_server_conf *conf, + const char *url, + int matchable) { proxy_worker *worker; proxy_worker *max_worker = NULL; @@ -1783,11 +1784,11 @@ static int ap_proxy_strcmp_ematch(const char *str, && (worker_name_length >= min_match) && (worker_name_length > max_match) && (worker->s->is_name_matchable - || strncmp(url_copy, worker->s->name, - worker_name_length) == 0) + || (!matchable && strncmp(url_copy, worker->s->name, + worker_name_length) == 0)) && (!worker->s->is_name_matchable - || ap_proxy_strcmp_ematch(url_copy, - worker->s->name) == 0) ) { + || (matchable && ap_proxy_strcmp_ematch(url_copy, + worker->s->name) == 0))) { max_worker = worker; max_match = worker_name_length; } @@ -1799,11 +1800,11 @@ static int ap_proxy_strcmp_ematch(const char *str, && (worker_name_length >= min_match) && (worker_name_length > max_match) && (worker->s->is_name_matchable - || strncmp(url_copy, worker->s->name, - worker_name_length) == 0) + || (!matchable && strncmp(url_copy, worker->s->name, + worker_name_length) == 0)) && (!worker->s->is_name_matchable - || ap_proxy_strcmp_ematch(url_copy, - worker->s->name) == 0) ) { + || (matchable && ap_proxy_strcmp_ematch(url_copy, + worker->s->name) == 0))) { max_worker = worker; max_match = worker_name_length; } @@ -1813,6 +1814,22 @@ static int ap_proxy_strcmp_ematch(const char *str, return max_worker; } +PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p, + proxy_balancer *balancer, + proxy_server_conf *conf, + const char *url) +{ + return proxy_get_worker(p, balancer, conf, url, 0); +} + +PROXY_DECLARE(proxy_worker *) ap_proxy_get_match_worker(apr_pool_t *p, + proxy_balancer *balancer, + proxy_server_conf *conf, + const char *url) +{ + return proxy_get_worker(p, balancer, conf, url, 1); +} + /* * To create a worker from scratch first we define the * specifics of the worker; this is all local data.