[MEDIUM] add support for conditional HTTP redirection

A new "redirect" keyword adds the ability to send an HTTP 301/302/303
redirection to either an absolute location or to a prefix followed by
the original URI. The redirection is conditionned by ACL rules, so it
becomes very easy to move parts of a site to another site using this.

This work was almost entirely done at Exceliance by Emeric Brun.

A test-case has been added in the tests/ directory.
This commit is contained in:
Willy Tarreau
2008-06-07 23:08:56 +02:00
parent 8001d6162e
commit b463dfb2de
7 changed files with 276 additions and 0 deletions

View File

@@ -648,6 +648,7 @@ void deinit(void)
struct hdr_exp *exp, *expb;
struct acl *acl, *aclb;
struct switching_rule *rule, *ruleb;
struct redirect_rule *rdr, *rdrb;
struct uri_auth *uap, *ua = NULL;
struct user_auth *user;
int i;
@@ -758,6 +759,14 @@ void deinit(void)
free(rule);
}
list_for_each_entry_safe(rdr, rdrb, &p->redirect_rules, list) {
LIST_DEL(&rdr->list);
prune_acl_cond(rdr->cond);
free(rdr->cond);
free(rdr->rdr_str);
free(rdr);
}
if (p->appsession_name)
free(p->appsession_name);