summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http.h
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2023-04-20 23:20:41 +0800
committerZhidao HONG <z.hong@f5.com>2023-04-20 23:20:41 +0800
commit14d6d97bacf9b06ba340ebd4211b2f1b6ad417dd (patch)
tree68dd559c475cc0dffdf1254c75971fcae9a89ed5 /src/nxt_http.h
parent8843e30e8275aa70bf7eec11709cd5d12e32b4ae (diff)
downloadunit-14d6d97bacf9b06ba340ebd4211b2f1b6ad417dd.tar.gz
unit-14d6d97bacf9b06ba340ebd4211b2f1b6ad417dd.tar.bz2
HTTP: added basic URI rewrite.
This commit introduced the basic URI rewrite. It allows users to change request URI. Note the "rewrite" option ignores the contained query if any and the query from the request is preserverd. An example: "routes": [ { "match": { "uri": "/v1/test" }, "action": { "return": 200 } }, { "action": { "rewrite": "/v1$uri", "pass": "routes" } } ] Reviewed-by: Alejandro Colomar <alx@nginx.com>
Diffstat (limited to 'src/nxt_http.h')
-rw-r--r--src/nxt_http.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nxt_http.h b/src/nxt_http.h
index d7bbaf02..08e1fcbe 100644
--- a/src/nxt_http.h
+++ b/src/nxt_http.h
@@ -226,6 +226,7 @@ typedef struct nxt_http_route_addr_rule_s nxt_http_route_addr_rule_t;
typedef struct {
+ nxt_conf_value_t *rewrite;
nxt_conf_value_t *pass;
nxt_conf_value_t *ret;
nxt_conf_value_t *location;
@@ -253,6 +254,7 @@ struct nxt_http_action_s {
nxt_str_t *pass;
} u;
+ nxt_tstr_t *rewrite;
nxt_http_action_t *fallback;
};
@@ -378,6 +380,11 @@ nxt_int_t nxt_upstreams_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_int_t nxt_upstreams_joint_create(nxt_router_temp_conf_t *tmcf,
nxt_upstream_t ***upstream_joint);
+nxt_int_t nxt_http_rewrite_init(nxt_router_conf_t *rtcf,
+ nxt_http_action_t *action, nxt_http_action_conf_t *acf);
+nxt_int_t nxt_http_rewrite(nxt_task_t *task, nxt_http_request_t *r,
+ nxt_http_action_t *action);
+
nxt_int_t nxt_http_return_init(nxt_router_conf_t *rtcf,
nxt_http_action_t *action, nxt_http_action_conf_t *acf);