# Apply the check only on first contact with the request
if (fastly.ff.visits_this_service == 0 && req.restarts == 0) {

  # Check whether the client's IP is in the ban list
  if (req.http.Fastly-Client-IP ~ ban_acl) {
    log "syslog " + req.service_id + " loggerName :: Ban in effect for " + req.http.Fastly-Client-IP;
    error 601 "banned-ip";
  } else {
    # The IP is NOT in the ban list
    log "syslog " + req.service_id + " loggerName :: " + req.http.Fastly-Client-IP + " is not banned.";
  }
}