Hi Matt,
Le 11/04/2014 18:45, Matt Higgins a écrit :
I think the subject covers it. I need to build a list of many 301 redirects
within the same domain i.e. redirect /some_old_place to /some_new_place.
We have lots of content the gets retired or replaced based on url. The quote
from the current home page of haproxy states maps may be used to "build
massive redirect tables" but for the life of me I can figure it out. I am using
version 1.5 and here are the lines of the config which I am currently am
working on.
redirect location %[map(/opt/local/etc/haproxy/redirect.map), hdr(url)]
code 301
Given the above config line I get
[ALERT] 099/205518 (27981) : parsing
[/opt/local/etc/haproxy/haproxy.cfg:83] :
error detected in frontend 'LoadBalancer' while parsing redirect rule :
expects 'code', 'prefix', 'location', 'scheme', 'set-cookie', 'clear-cookie',
'drop-query' or 'append-slash' (was 'hdr(url)]').
I have tried many variations of this but have not found any success. If anyone
knows how to do this please let me know?
I see several issues :
1. In order to not break older configurations, "redirect" will not
support dynamic values, "http-request redirect" does.
2. Avoid spaces between parameters (between map and hdr).
3. Parameters are declared in the wrong order.
4. The URL is not a header, you can try with "path" instead.
Can you retry with :
http-request redirect location
%[path,map(/opt/local/etc/haproxy/redirect.map)] code 301
--
Cyril Bonté