haproxy/tests/test-redirect.cfg
Willy Tarreau b463dfb2de [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.
2008-06-07 23:08:56 +02:00

42 lines
1.1 KiB
INI

# This is a test configuration.
# It is used to check the redirect keyword.
global
maxconn 400
stats timeout 3s
listen sample1
mode http
retries 1
option redispatch
timeout client 1m
timeout connect 5s
timeout server 1m
maxconn 400
bind :8000
acl url_test1 url_reg test1
acl url_test2 url_reg test2
redirect location /abs/test code 301 if url_test1
redirect prefix /pfx/test code 302 if url_test2
redirect prefix /pfx/test code 303 if url_test2
### unconditional redirection
#redirect location https://example.com/ if TRUE
### parser must detect invalid syntaxes below
#redirect
#redirect blah
#redirect location
#redirect location /abs/test
#redirect location /abs/test code
#redirect location /abs/test code 300
#redirect location /abs/test code 301
#redirect location /abs/test code 304
balance roundrobin
server act1 127.0.0.1:80 weight 10
option httpclose
stats uri /stats
stats refresh 5000ms