0

I am trying to rewrite a single path via HAProxy. Without the rule in place, a 404 is returned for the directory page (from an IIS node). Once I add the rule, the page returns a 504 Gateway Timeout after a minute or so.

backend Example_Backend
    balance uri
    reqirep ^([^\ ]*)\ (.*)/directory/?[\ ]    \1\ \2/target.asp\ 
    server Server1 x.x.x.xx4:80 weight 25 check fall 10 rise 2 maxconn 40
    server Server2 x.x.x.xx5:80 weight 25 check fall 10 rise 2 maxconn 40
    server Server3 x.x.x.xx6:80 weight 25 check fall 10 rise 2 maxconn 40
    server Server4 x.x.x.xx7:80 weight 25 check fall 10 rise 2 maxconn 40

Is there anything wrong with the way I'm using reqirep? I have tested using sed to make sure it matches correctly for the following:

GET http://www.example.com/directory HTTP/1.1
GET http://www.example.com/directory/ HTTP/1.1

Thoughts?

Edit: Logs from testing /directory and /directory/

haproxy[25957]: x.x.x.100:50941 [31/May/2011:14:53:24.836] Example_Frontend Example_Backend/Server4 77/0/3/-1/50083 504 194 - - sH-- 1/1/1/1/0 0/0 "GET /directory/ HTTP/1.1"
haproxy[25957]: x.x.x.100:50942 [31/May/2011:14:53:26.124] Example_Frontend Example_Backend/Server4 78/0/5/-1/50087 504 194 - - sH-- 0/0/0/0/0 0/0 "GET /directory HTTP/1.1"

1 Answer 1

1

Cyril from the HAProxy mailing list pointed out that the regex was removing the HTTP/1.1 and HTTP/1.0 from the request. He suggested the following (which worked):

reqirep ^([^\ ]*)\ (.*)/directory/?\ (.*)       \1\ \2/target.asp\ \3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .