Thanks Kevin, it seems I missed this one.

On Fri, Dec 27, 2019 at 05:38:15PM +0800, Kevin Zhu wrote:
> global
> log 127.0.0.1 local4 info
> 
> defaults
> mode http
> timeout connect 10s
> timeout client 300s
> timeout server 300s
> 
> listen inhttp
> option httplog
> log global
> bind ipv4@:80
> log-format %ci:%cp/%b/%si:%sp\ %ST\ %ts\ %U/%B\ %{+Q}r\ %sslv\ %hr
> http-response redirect location https://www.google.com if TRUE
> use_backend be_1
> 
> backend be_1
> server out 10.20.136.221:8080
> source 0.0.0.0 usesrc 10.20.136.225
> [root@localhost haproxy]#
> [root@localhost haproxy]# ./haproxy-master -f haproxy.conf.master
> 
> HAProxy log:
> Dec 27 03:23:56 127.0.0.1 haproxy-master[19682]: Proxy inhttp started.
> Dec 27 03:24:10 127.0.0.1 haproxy-master[19682]:
> 10.20.136.222:63654/be_1/10.20.136.221:8080 302 LR 89/404 "GET /ping
> HTTP/1.1"
> 
> Client host:
> [root@localhost ~]# curl http://10.20.136.225/ping -v
> *   Trying 10.20.136.225...
> * TCP_NODELAY set
> * Connected to 10.20.136.225 (10.20.136.225) port 80 (#0)
> > GET /ping HTTP/1.1
> > Host: 10.20.136.225
> > User-Agent: curl/7.29.0
> > Accept: */*
> >
> < HTTP/1.1 200 OK
> < content-type: text/plain; charset=utf-8
> < date: Thu, 26 Dec 2019 19:24:10 GMT
> < content-length: 23
> <
> This is response body.
> * Curl_http_done: called premature == 0
> * Connection #0 to host 10.20.136.225 left intact
> [root@localhost ~]#
> 
> The config file have rule:
> http-response redirect location https://www.google.com if TRUE
> and HAProxy log show the response code is 302, but client got server's
> response, not redirect.

OK that's clearer now. I tried your config and the results vary a lot
depending on versions, I think there were multiple breakage stages:

  - 1.8 works as expected
  - 1.9 and 2.0 in legacy mode returns 200 but apparently limited to the
    size of the redirect so it misses some headers and the final CRLF,
    and hangs till the client timeout strikes
  - 1.9 and 2.0 in HTX mode returns the whole 200 response
  - 2.1 and above only support HTX and behave like 2.0 for this

I'll rather wait for Christopher next week to double-check your patch and
to see if the issue is deeper or just related to this, especially for the
HTX case which looks odd.

Thanks!
Willy

Reply via email to