Hi
The request never reached the application server. It first reached port 80
then haproxy adds a header and sends to port localhost:81 which is also
handled by haproxy. For 502 requests, they never reached port 81.
On Sat, Feb 18, 2017 at 4:58 AM Dennis Jacobfeuerborn <[email protected]>
wrote:
> On 17.02.2017 12:42, Chungwei Yen wrote:
> > Hi
> >
> > I am having a strange error when sending requests back to haproxy. The
> > configuration is to have an additional layer of frontend/backend to
> > generate a unique request id for every request then redirect back to
> > haproxy to the real frontend.
> > This works fine in the the beginning, but after several minutes I started
> > to see 502 errors, most of the query still works, 502 only happens to
> about
> > 1% of the request but it is already causing problems. Any idea what could
> > cause this?
> >
> > The haproxy.cfg looks like this
> >
> > frontend logger-in
> > mode http
> > bind *:80,*:8080
> > no log
> > timeout http-keep-alive 5s
> > acl existing-uniq-id req.hdr(X-Unique-ID) -m found
> > http-request set-header X-Unique-ID %{+X}o\ci:%cp_%fi:%fp_%Ts_%rt:%pid
> > unless existing-uniq-id
> > default_backend logger
> >
> > backend logger
> > mode http
> > server localhost localhost:81 send-proxy
> >
> > frontend jetty-in
> > mode http
> > bind *:80,*:8080
> > option httplog
> > option dontlognull
> > ...
> >
> > -------------------------------------------------
> > 502 errors:
> >
> > Feb 16 23:45:57 localhost haproxy[73824]: 10.23.0.36:49839
> > [16/Feb/2017:23:45:57.938] logger-in logger/localhost 0/0/0/-1/0 502 204
> -
> > - SH-- 49/15/2/2/0 0/0 "GET request url HTTP/1.1"
> > Feb 16 23:46:54 localhost haproxy[73824]: 10.23.0.32:53487
> > [16/Feb/2017:23:46:54.990] logger-in logger/localhost 0/0/0/-1/0 502 204
> -
> > - SH-- 62/21/4/4/0 0/0 "GET request url HTTP/1.1"
> > Feb 16 23:47:27 localhost haproxy[73824]: 10.23.0.46:57830
> > [16/Feb/2017:23:47:27.306] logger-in logger/localhost 0/0/0/-1/0 502 204
> -
> > - SH-- 62/21/6/6/0 0/0 "GET request url HTTP/1.1"
> > Feb 16 23:47:31 localhost haproxy[73824]: 10.23.0.38:64621
> > [16/Feb/2017:23:47:31.377] logger-in logger/localhost 0/0/0/-1/0 502 204
> -
> > - SH-- 69/25/8/8/0 0/0 "GET request url HTTP/1.1"
> > Feb 16 23:47:33 localhost haproxy[73824]: 10.23.0.32:53630
> > [16/Feb/2017:23:47:33.706] logger-in logger/localhost 0/0/0/-1/0 502 204
> -
> > - SH-- 77/29/11/11/0 0/0 "GET request url HTTP/1.1"
>
> Have you checked the error log on the servers?
> According to the haproxy documentation the flags "SH--" mean:
>
> S : the TCP session was unexpectedly aborted by the server, or the
> server explicitly refused it.
> H : the proxy was waiting for complete, valid response HEADERS from the
> server (HTTP only).
>
> So it seems the servers have some problem responding to the requests.
>
> Regards,
> Dennis
>
> --
Chungwei Yen