Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion doc/admin-guide/files/remap.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,12 @@ Acl Filters

Acl filters can be created to control access of specific remap lines. The markup
is very similar to that of :file:`ip_allow.yaml`, with slight changes to
accommodate remap markup
accommodate remap markup.

**Note:** As of ATS v10.x, these filters are applied just as :file:`ip_allow.yaml`,
this means once a filter matches the request, the action for that rule takes effect.
In previous versions, all filters for a remap rule were evaluated, and the ``deny``
action took priority.

Examples
--------
Expand Down
29 changes: 12 additions & 17 deletions proxy/http/remap/UrlRewrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ UrlRewrite::PerformACLFiltering(HttpTransact::State *s, url_mapping *map)
s->acl_filtering_performed = true; // small protection against reverse mapping

if (map->filter) {
int method = s->hdr_info.client_request.method_get_wksidx();
int method_wksidx = (method != -1) ? (method - HTTP_WKSIDX_CONNECT) : -1;
bool client_enabled_flag = true;
int method = s->hdr_info.client_request.method_get_wksidx();
int method_wksidx = (method != -1) ? (method - HTTP_WKSIDX_CONNECT) : -1;

ink_release_assert(ats_is_ip(&s->client_info.src_addr));

for (acl_filter_rule *rp = map->filter; rp && client_enabled_flag; rp = rp->next) {
s->client_connection_enabled = true; // Default is that we allow things unless some filter matches

for (acl_filter_rule *rp = map->filter; rp; rp = rp->next) {
bool match = true;

if (rp->method_restriction_enabled) {
Expand Down Expand Up @@ -474,22 +475,16 @@ UrlRewrite::PerformACLFiltering(HttpTransact::State *s, url_mapping *map)
Debug("url_rewrite", "%s an internal request", match ? "matched" : "didn't match");
}

if (match && client_enabled_flag) { // make sure that a previous filter did not DENY
if (match) {
// We have a match, stop evaluating filters
Debug("url_rewrite", "matched ACL filter rule, %s request", rp->allow_flag ? "allowing" : "denying");
client_enabled_flag = rp->allow_flag ? true : false;
s->client_connection_enabled = rp->allow_flag;
break;
} else {
if (!client_enabled_flag) {
Debug("url_rewrite", "Previous ACL filter rule denied request, continuing to deny it");
} else {
Debug("url_rewrite", "did NOT match ACL filter rule, %s request", rp->allow_flag ? "denying" : "allowing");
client_enabled_flag = rp->allow_flag ? false : true;
}
Debug("url_rewrite", "did NOT match ACL filter rule, %s request", rp->allow_flag ? "denying" : "allowing");
}

} /* end of for(rp = map->filter;rp;rp = rp->next) */

s->client_connection_enabled = client_enabled_flag;
}
}
} /* end of for(rp = map->filter;rp;rp = rp->next) */
}

/**
Expand Down