acl - How to route traffic (reverse Proxy) with HAProxy based on request body -
i attempting route following request appropriate servers based on url identified in post body below. hoping accomplish via reverse proxy using haproxy.
e.g. direct requests haproxy, have haproxy check if values exist in post body (e.g. notification url value "pingpong"), , if case, route traffic endopint specify in configs.
post /someurl/file.jsp http/1.1 host: 10.43.90.190:80 content-type: application/json connection: keep-alive accept: */* content-length: 256 {"info": {"groupname":"thisgroup1","id":"m1234r456","id2":"tup1234", "countrycode":"usa","carriercode":"usaic","e164address":"123456768789", "notificationurl":"http:\/\/www.pingpong.com\/notify", "timestamp":"2014-03-04t17:33:30.000z"}}
is there way use acl search content, "pingpong" in request body, , based on value, route appropriately?
thanks!
this can done using simple access control list (acl). however, wasn't possible until haproxy 1.6 (october 2015), can include option in frontend:
option http-buffer-request
this option gives haproxy access body. can use req.body access body. example:
frontend http-in bind *:80 option http-buffer-request acl redirect_pingpong req.body -m reg [insert regular expression here] use_backend pingpong_backend if redirect_pingpong default_backend web_bk
and go on define backends.
further information on accessing body content can found here , information acls can found here.
Comments
Post a Comment