slash in the request. If both parameters are specified, the
evaluation stops when either is reached.
+ A "path-only" parameter indicates that the hashing key starts
+ at the first '/' of the path. This can be used to ignore the
+ authority part of absolute URIs, and to make sure that HTTP/1
+ and HTTP/2 URIs will provide the same hash.
+
url_param The URL parameter specified in argument will be looked up in
the query string of each HTTP GET request.
struct ist uri;
uri = htx_sl_req_uri(http_get_stline(htxbuf(&s->req.buf)));
+ if (s->be->lbprm.arg_opt1 & 2) {
+ uri = http_get_path(uri);
+ if (!uri.ptr)
+ uri = ist("");
+ }
srv = get_server_uh(s->be, uri.ptr, uri.len, prev_srv);
}
break;
curproxy->lbprm.algo &= ~BE_LB_ALGO;
curproxy->lbprm.algo |= BE_LB_ALGO_UH;
- curproxy->lbprm.arg_opt1 = 0; // "whole"
+ curproxy->lbprm.arg_opt1 = 0; // "whole", "path-only"
curproxy->lbprm.arg_opt2 = 0; // "len"
curproxy->lbprm.arg_opt3 = 0; // "depth"
curproxy->lbprm.arg_opt1 |= 1;
arg += 1;
}
+ else if (!strcmp(args[arg], "path-only")) {
+ curproxy->lbprm.arg_opt1 |= 2;
+ arg += 1;
+ }
else {
- memprintf(err, "%s only accepts parameters 'len', 'depth', and 'whole' (got '%s').", args[0], args[arg]);
+ memprintf(err, "%s only accepts parameters 'len', 'depth', 'path-only', and 'whole' (got '%s').", args[0], args[arg]);
return -1;
}
}