diff --git a/src/http_act.c b/src/http_act.c index 2eac12549..51cbf7d7d 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -214,8 +214,8 @@ static enum act_return http_action_replace_uri(struct act_rule *rule, struct pro goto fail_alloc; uri = htx_sl_req_uri(http_get_stline(htxbuf(&s->req.buf))); - if (rule->action == 1) // replace-path - uri = iststop(http_get_path(uri), '?'); + if (rule->action == 4) // replace-path + uri = http_get_path(uri); if (!regex_exec_match2(rule->arg.http.re, uri.ptr, uri.len, MAX_MATCH, pmatch, 0)) goto leave; @@ -273,7 +273,7 @@ static enum act_parse_ret parse_replace_uri(const char **args, int *orig_arg, st char *error = NULL; if (strcmp(args[cur_arg-1], "replace-path") == 0) - rule->action = 1; // replace-path, same as set-path + rule->action = 4; // replace-path else rule->action = 3; // replace-uri, same as set-uri diff --git a/src/http_ana.c b/src/http_ana.c index 43c2145bd..73b6e7618 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2785,6 +2785,11 @@ int http_req_replace_stline(int action, const char *replace, int len, return -1; break; + case 4: // path + query + if (!http_replace_req_path(htx, ist2(replace, len), 1)) + return -1; + break; + default: return -1; }