You may be hit by the fact that hdr_dom(host) is sort of broken before 1.4.18. Some clients include the port number in the Host header, and hdr_dom() would not match those. If this is your problem, either upgrade haproxy to 1.4.18+, 1.5-dev7+, or you can use one of the following workarounds:
Add an explicit match for the port as well: acl is_gateway_bringr hdr_dom(host) -i gateway.brin.gr acl is_gateway_bringr hdr_dom(host) -i gateway.brin.gr:80 # Added workaround Or strip away top level domain, and use acl is_gateway_bringr hdr_dom(host) -i gateway.brin <http://gateway.brin.gr> - Finn Arne On Thu, May 3, 2012 at 6:48 PM, Francois-Guillaume Ribreau < [email protected]> wrote: > In fact I started with an new fresh configuration without all those > options and now it works well (I still have http-server-close & > forceclose). But I had to remove the "default_backend nginx" directive > because it was the root issue. Sometimes HAProxy was going through the acls > (below) without selecting the right backend (gateway_bringr). Thus, it was > falling back to the default_backend (nginx) and that's why the 502 errors > were coming (see http://pastebin.com/yHHkJpcX ) > > acl is_gateway_bringr hdr_dom(host) -i gateway.brin.gr > acl is_gateway_bringr hdr_dom(host) -i gateway.bringr.dev > > > I don't understand your answer ( I'm new to HAProxy ) because > gateway_bringr is an http and websockets server so it should have "option > http-server-close" and "option forceclose" isn't it ? > > And I'm running HA-Proxy v1.4.15. > > On Wed, May 2, 2012 at 11:48 PM, Baptiste <[email protected]> wrote: > >> on the backend gateway_bringr, please comment the http-server-close >> option as well as forceclose. >> It will turn this backend in tunnel mode. >> >> As far as I remember, haproxy fails back automatically to the tunnel mode >> for websockets opened in a backend in "http-server-close" mode. >> But I don't know from which version of haproxy it is available... >> >> Which version are you running? >> What does the log says??? >> >> cheers >> >> >> On Tue, May 1, 2012 at 1:26 AM, Francois-Guillaume Ribreau < >> [email protected]> wrote: >> >>> Thanks for your answer >>> >>> However, I removed the "mode tcp" line from the frontend block and I >>> still have the same issue. >>> >>> Do you have any other ideas ? >>> >>> Thanks >>> >>> >>> On Mon, Apr 30, 2012 at 11:20 PM, Baptiste <[email protected]> wrote: >>> >>>> On Mon, Apr 30, 2012 at 3:17 PM, Francois-Guillaume Ribreau >>>> <[email protected]> wrote: >>>> > On the main page of my website multiple http requests are made on >>>> different >>>> > domains (brin.gr, static.brin.gr and gateway.brin.gr). >>>> > Sometimes everything's fine, sometimes the http request to >>>> gateway.brin.gr >>>> > returns 502. >>>> > >>>> > I've started HAProxy in debug mode and found out that the 502 error >>>> occur >>>> > when the request is done on the wrong backend (the request is done on >>>> > default backend "nginx" instead of "gateway"), >>>> > see http://pastebin.com/yHHkJpcX. >>>> > >>>> > So it seems to be a configuration issue. FYI Gateway.brin.gr is >>>> process that >>>> > act as an http server and a websocket server and runs on the local >>>> port >>>> > 8080. >>>> > >>>> > Here is the configuration file: http://pastebin.com/ddmDzZLG >>>> > >>>> > You can try accessing http://brin.gr by yourself and see that >>>> sometimes the >>>> > request gateway.brin.gr will throw a 502 error. >>>> > >>>> > What did I do wrong ? >>>> > >>>> > Thanks a lot for your time. >>>> >>>> Hi, >>>> >>>> It may be due because your frontend is in TCP mode and I'm almost sure >>>> that HTTP acls will always return 0. >>>> Maybe Willy will confirm, or not :) >>>> >>>> cheers >>>> >>> >>> >>> >>> -- >>> Francois-Guillaume Ribreau [image: LinkedIn] >>> <http://www.linkedin.com/in/francoisguillaumeribreau> >>> <http://www.doyoubuzz.com/francois-guillaume-ribreau> [image: >>> Twitter] <http://twitter.com/FGRibreau> [image: Site] >>> <http://fgribreau.com/> >>> <http://www.viadeo.com/fr/profile/francois-guillaume.ribreau> [image: >>> Blog] <http://blog.fgribreau.com/> >>> >>> >> > > > -- > Francois-Guillaume Ribreau [image: LinkedIn] > <http://www.linkedin.com/in/francoisguillaumeribreau> > <http://www.doyoubuzz.com/francois-guillaume-ribreau> [image: > Twitter] <http://twitter.com/FGRibreau> [image: Site] > <http://fgribreau.com/> > <http://www.viadeo.com/fr/profile/francois-guillaume.ribreau> [image: > Blog] <http://blog.fgribreau.com/> > >

