diff --git a/proxy/http/remap/RemapProcessor.cc b/proxy/http/remap/RemapProcessor.cc index fc3c14cd8ba..ca74117fb56 100644 --- a/proxy/http/remap/RemapProcessor.cc +++ b/proxy/http/remap/RemapProcessor.cc @@ -106,6 +106,14 @@ RemapProcessor::setup_for_remap(HttpTransact::State *s) mapping_found = rewrite_table->forwardMappingLookup(request_url, request_port, request_host, request_host_len, s->url_map); } + // If no rules match and we have a host, check empty host rules since + // they function as default rules for server requests. + // If there's no host, we've already done this. + if (!mapping_found && rewrite_table->nohost_rules && request_host_len) { + Debug("url_rewrite", "[lookup] nothing matched"); + mapping_found = rewrite_table->forwardMappingLookup(request_url, 0, "", 0, s->url_map); + } + if (!proxy_request) { // do extra checks on a server request // Save this information for later @@ -114,14 +122,6 @@ RemapProcessor::setup_for_remap(HttpTransact::State *s) s->hh_info.request_host = request_host; s->hh_info.request_port = request_port; - // If no rules match and we have a host, check empty host rules since - // they function as default rules for server requests. - // If there's no host, we've already done this. - if (!mapping_found && rewrite_table->nohost_rules && request_host_len) { - Debug("url_rewrite", "[lookup] nothing matched"); - mapping_found = rewrite_table->forwardMappingLookup(request_url, 0, "", 0, s->url_map); - } - if (mapping_found) { // Downstream mapping logic (e.g., self::finish_remap()) // apparently assumes the presence of the target in the URL, so