[MINOR] redirect: add support for the "drop-query" option
If "drop-query" is present on a "redirect" line using the "prefix" mode,
then the returned Location header will be the request URI without the
query-string. This may be used on some login/logout pages, or when it
must be decided to redirect the user to a non-secure server.
(cherry-picked from commit f2d361ccd73aa16538ce767c766362dd8f0a88fd)
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 5394b6b..ede1b22 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1118,6 +1118,7 @@
int type = REDIRECT_TYPE_NONE;
int code = 302;
char *destination = NULL;
+ unsigned int flags = REDIRECT_FLAG_NONE;
cur_arg = 1;
while (*(args[cur_arg])) {
@@ -1157,6 +1158,9 @@
return -1;
}
}
+ else if (!strcmp(args[cur_arg],"drop-query")) {
+ flags |= REDIRECT_FLAG_DROP_QS;
+ }
else if (!strcmp(args[cur_arg], "if")) {
pol = ACL_COND_IF;
cur_arg++;
@@ -1200,6 +1204,7 @@
rule->rdr_len = strlen(destination);
rule->type = type;
rule->code = code;
+ rule->flags = flags;
LIST_INIT(&rule->list);
LIST_ADDQ(&curproxy->redirect_rules, &rule->list);
}