Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions proxy/http/remap/RemapProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down