---------- Forwarded message ---------
From: Kevin Zhu <ip0...@gmail.com>
Date: Thu, 26 Dec 2019 at 19:33
Subject: Re: BUG/MEDIUM: http: res redir not work coz exist res contents
not truncate
To: Willy Tarreau <w...@1wt.eu>

Hello Willy, sorry for I haven't clarified the issue, contents below here
is my testing envirements:

The host running HAProxy:

[root@localhost haproxy]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
    link/ether 58:58:0a:14:88:e0 brd ff:ff:ff:ff:ff:ff
    inet 10.20.136.224/24 brd 10.20.136.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5a58:aff:fe14:88e0/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
    link/ether 0c:0a:14:88:e0:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::e0a:14ff:fe88:e002/64 scope link
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
    link/ether 0c:0a:14:88:e0:03 brd ff:ff:ff:ff:ff:ff
    inet 10.20.136.225/24 brd 10.20.136.255 scope global eth2
       valid_lft forever preferred_lft forever
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
    link/ether 0c:0a:14:88:e0:04 brd ff:ff:ff:ff:ff:ff
[root@localhost haproxy]#
[root@localhost haproxy]# cat haproxy.conf.master
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.

On Thu, 26 Dec 2019 at 13:36, Willy Tarreau <w...@1wt.eu> wrote:

> Hi Kevin,
>
> On Tue, Dec 24, 2019 at 04:52:04PM +0800, Kevin Zhu wrote:
> > Hi
> > The "http-response redirect location" action not work will because of the
> > received response contents from the server have no truncate.
> > the attach patches should fix that.
>
> Sorry, but I didn't undertand what the issue is, and there is no commit
> message in your patches to explain it either. Do you have an example of
> config and request/response showing the wrong behaviour ?
>
> Willy
>

Reply via email to