On Wed, Oct 29, 2014 at 4:02 PM, M. Lebbink <mlebb...@photographity.nl> wrote:
> 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?

Well, your rewrite rule breaks HTTP protocol :)
You may want to try
  acl has_jpg path_sub jpg
  reqirep ^([^\ ]*)\ /?folder=(.*)&file=(.*).jpg(.*)
\1\2/slides/\3.jpg\4 if has_jpg

=> your missing the \4 which tells your rule to copy the data after
the extension of the file. Should be something like " HTTP/1.1".

Now your HTTP protocol is fixed in your reqirep rule, you may be able
to test it and update it accordingly.
You should update your acl, because yours matches in the path, which
obviously is '/' in your case.
You want to match anywhere in the URL I guess, give a try to url_sub.

Baptiste

Reply via email to