Hi Baptiste,
Thank you for your response, it helped somewhat..... but I'm starting to
think I'm to stupid for this....
My issue....
I have multiple websites on multiple servers running behind 2 haproxy
servers.
One of the websites servers photo's using fotoplayer. In order for people to
link to photo's I get
the following request:
sub.domain.com/?folder=Harmelen%2F2014-09-27%2F&file=_DSC0001.jpg
Using https rewrite rules:
RewriteCond %{QUERY_STRING} ^(.*)?folder=(.*)&file=(.*).jpg(.*)$
RewriteRule / /%1%2slides/%3.jpg
I can rebuild this to
sub.domain.com/Harmelen%2F2014-09-27/slides/_DSC0001.jpg
But my webserver is not understanding the %2F and issues a html 404.
Resubmitting the same request directly onto the
server will produce the requested photo (tried playing with
AllowEncodedSlashes but that does not help).
So, I thought, let HAproxy 1.5.x do the url rebuild.... I have tried all
sorts of combinations and itterations of this:
acl has_jpg path_sub jpg
reqirep ^([^\ ]*)\ /?folder=(.*)&file=(.*).jpg(.*) \1\2/slides/\3.jpg
if has_jpg
But sofar, no dice....
Any hint's or tips on getting this to actually work?
-----Original Message-----
From: Baptiste
Sent: Wednesday, October 29, 2014 1:48 PM
To: M. Lebbink
Cc: HAProxy
Subject: Re: Wrestling with rewrites
On Wed, Oct 29, 2014 at 11:07 AM, M. Lebbink <[email protected]>
wrote:
Hi list,
I've been wrestling with rewrite rules withing haproxy and httpd, but I
can't find the docs I would like to read.
I keep reading examples with all sorts of rules containing hdr_dom(host) &
hdr_beg(host). But I can't find
any description of what is actually contained in these values.
Does anyone have a link or pdf listing and describing these headers?
All I want to do is check if there is a specific string in the URL for one
of the backends and if it is present, rewrite
that rule by replacing parts of it to create something the httpd server
will
actually understand.....
Michiel
Hi,
What you want to do is a reqirep conditionned by an ACL on path.
The doc:
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#reqirep
The example:
reqrep ^([^\ :]*)\ /static/(.*) \1\ /\2 if {path_beg /static/ }
The doc about path acl:
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#path
other ACLs are defined in the same chapter.
Baptiste