Wrong mirror url, merged with original url
nothinux opened this issue · comments
Haproxy version
HA-Proxy version 2.3.10-1ppa1~bionic 2021/04/24 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2022.
Known bugs: http://www.haproxy.org/bugs/bugs-2.3.10.html
Running on: Linux 5.4.0-1046-azure #48~18.04.1-Ubuntu SMP Tue Apr 13 19:41:38 UTC 2021 x86_64
Haproxy config
global
# for logging section
log 127.0.0.1 local2 info
log /dev/log local2
log /dev/log local3 notice
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 10000
user haproxy
group haproxy
daemon
defaults
mode http
log global
option httplog
timeout connect 1s
timeout client 30s
timeout server 300s
timeout client-fin 10s
frontend www
bind *:80
log global
option httplog
redirect scheme https code 301 if !{ ssl_fc }
default_backend www_backend
frontend www_https
bind *:443 ssl alpn h2,http/1.1 crt /etc/haproxy/certs/cert.pem
log global
option tcplog
mode http
option forwardfor
option http-server-close
option http-buffer-request
filter spoe engine mirror config /etc/haproxy/mirror.conf
http-request set-header X-Forwaded-Proto https if { ssl_fc }
http-request set-header X-Forwaded-Port 443
default_backend main_backend
backend mirroragents
mode tcp
balance roundrobin
timeout connect 5s
timeout server 5s
server agent1 127.0.0.1:12345
backend main_backend
mode http
balance roundrobin
option forwardfor
option httpchk
http-check connect
http-check send meth GET uri /ready ver HTTP/1.1
http-check expect status 200
server www1 10.0.0.10:80 weight 20 check inter 3s fall 2
Mirror config
[mirror]
spoe-agent mirror
log global
messages mirror
use-backend mirroragents
timeout hello 500ms
timeout idle 5s
timeout processing 5s
spoe-message mirror
args arg_method=method arg_path=url arg_ver=req.ver arg_hdrs=req.hdrs_bin arg_body=req.body
event on-frontend-http-request
Spoa agent run command
sudo spoa-mirror --runtime 0 --mirror-url "https://mirror.domain.net:443/" --logfile w:/var/log/haproxy-mirror.logs
Spoa-mirror debug log
[ 0][ 0.001648] --- start --- 2021-05-10 07:12:06 -------------------------
[ 1][ 9.368566] <1:26> --> Receiving data
[ 1][ 9.368574] <1:26> 4/4/4 byte(s) received frame length
[ 1][ 9.368577] <1:26> 129/129/129 byte(s) received frame data
[ 1][ 9.368581] <1:26> New frame of 129 bytes received: <0100000001000012737570706f727465642d76657273696f6e730803322e300e6d61782d6672616d652d73697a6503fcf0060c6361706162696c69746965730810706970656c696e696e672c6173796e6309656e67696e652d6964082461633433343761392d346639362d343730312d396530642d313335623336383833303431> <........supported-versions..2.0.max-frame-size.....capabilities..pipelining,async.engine-id.$ac4347a9-4f96-4701-9e0d-135b36883041>
[ 1][ 9.368583] <1> --> HAPROXY-HELLO decoding frame
[ 1][ 9.368587] <1> --> HAPROXY-HELLO header 1 0x01000000 0 0
[ 1][ 9.368588] <1> --> HAPROXY-HELLO stream-id=0 - frame-id=0
[ 1][ 9.368590] <1> K/V item: key=supported-versions
[ 1][ 9.368593] <1> --> HAPROXY-HELLO supported versions: 2.0
[ 1][ 9.368593] <1> K/V item: key=max-frame-size
[ 1][ 9.368594] <1> --> HAPROXY-HELLO maximum frame size: 16380
[ 1][ 9.368595] <1> K/V item: key=capabilities
[ 1][ 9.368596] <1> --> HAPROXY-HELLO capabilities check: pipelining,async
[ 1][ 9.368597] <1> --> HAPROXY-HELLO capabilities set: pipelining async
[ 1][ 9.368597] <1> K/V item: key=engine-id
[ 1][ 9.368598] <1> --> HAPROXY-HELLO engine id: ac4347a9-4f96-4701-9e0d-135b36883041
[ 1][ 9.368602] <1> <-- AGENT-HELLO encoding frame
[ 1][ 9.368606] <1> <-- AGENT-HELLO stream-id=0 - frame-id=0
[ 1][ 9.368607] <1> <-- AGENT-HELLO version: 2.0
[ 1][ 9.368607] <1> <-- AGENT-HELLO maximum frame size: 16380
[ 1][ 9.368608] <1> <-- AGENT-HELLO capabilities:
[ 1][ 9.368611] <1:26> <-- Sending data
[ 1][ 9.368660] <1:26> 4/4/4 byte(s) send frame length
[ 1][ 9.368678] <1:26> 54/54/54 byte(s) send frame data
[ 1][ 9.368680] <1:26> Frame of 54 bytes sent: <650000000100000776657273696f6e0803322e300e6d61782d6672616d652d73697a6503fcf0060c6361706162696c69746965730800> <e.......version..2.0.max-frame-size.....capabilities..>
[ 1][ 9.368719] <1:26> --> Receiving data
[ 1][ 9.368722] <1:26> 4/4/4 byte(s) received frame length
[ 1][ 9.368725] <1:26> 813/813/813 byte(s) received frame data
[ 1][ 9.368735] <1:26> New frame of 813 bytes received: <0300000001faf3c40101066d6972726f72050a6172675f6d6574686f640803474554086172675f70617468082368747470733a2f2f68612d617a7572652e6469636f64696e672e6e65742f7265616479076172675f7665720803322e30086172675f6864727309f91c0a757365722d6167656e744c4d6f7a696c6c612f352e3020285831313b205562756e74753b204c696e7578207838365f36343b2072763a38382e3029204765636b6f2f32303130303130312046697265666f782f38382e30066163636570744a746578742f68746d6c2c6170706c69636174696f6e2f7868746d6c2b786d6c2c6170706c69636174696f6e2f786d6c3b713d302e392c696d6167652f776562702c2a2f2a3b713d302e380f6163636570742d6c616e67756167650e656e2d55532c656e3b713d302e350f6163636570742d656e636f64696e6711677a69702c206465666c6174652c20627203646e74013119757067726164652d696e7365637572652d7265717565737473013102746508747261696c65727304686f73741568612d617a7572652e6469636f64696e672e6e657406636f6f6b6965fa085f67636c5f61753d312e312e3335363431343133322e313632303632393530343b206c61726176656c5f73657373696f6e3d65794a7064694936496c68455357744d5332747156325a71536d45794d564a32566d73725a6b453950534973496e5a686248566c496a6f69517a4250553252446332684f4e48423255317035633068514d6d6b345a55784c54444677546e426c4b7a4273626a4a7859564631517974614e3046354b31684c59304a68596b4d30646d5130516d6b79565539455a57317251324e56556c5646544670464d6b55774d6d5676546d3032566d633950534973496d316859794936496a6379597a4d344d3249354e544d784d324d314f544e6b5932517a4d7a45774e544a695a6a4e6c4e7a526c4d7a566a4d54646b5a474d7a596d5a6c4f5445775a6a51305a544934593252685a44566b4e4759774e54556966512533442533443b205f66775f63726d5f763d31616135306363622d346663372d346132342d666238642d6462326166316338336666370000086172675f626f64790900> <...........mirror..arg_method..GET.arg_path.#https://sub.domain.net/ready.arg_ver..2.0.arg_hdrs....user-agentLMozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0.acceptJtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8.accept-language.en-US,en;q=0.5.accept-encoding.gzip, deflate, br.dnt.1.upgrade-insecure-requests.1.te.trailers.host.sub.domain.net.cookie.._gcl_au=1.1.356414132.1620629504; laravel_session=eyJpdiI6IlhESWtMS2tqV2ZqSmEyMVJ2VmsrZkE9PSIsInZhbHVlIjoiQzBPU2RDc2hONHB2U1p5c0hQMmk4ZUxLTDFwTnBlKzBsbjJxYVF1QytaN0F5K1hLY0JhYkM0dmQ0QmkyVU9EZW1rQ2NVUlVFTFpFMkUwMmVvTm02Vmc9PSIsIm1hYyI6IjcyYzM4M2I5NTMxM2M1OTNkY2QzMzEwNTJiZjNlNzRlMzVjMTdkZGMzYmZlOTEwZjQ0ZTI4Y2RhZDVkNGYwNTUifQ%3D%3D; _fw_crm_v=1aa50ccb-4fc7-4a24-fb8d-db2af1c83ff7...arg_body..>
[ 1][ 9.368777] <1> --> HAPROXY-NOTIFY decoding frame
[ 1][ 9.368779] <1> --> HAPROXY-NOTIFY header 3 0x01000000 667690 1
[ 1][ 9.368780] <1> --> HAPROXY-NOTIFY stream-id=667690 - frame-id=1
[ 1][ 9.368781] <1> --> HAPROXY-NOTIFY - unfragmented frame received - frag_len=0 - len=813 - offset=10
[ 1][ 9.368786] <1> Process frame messages: stream-id=667690 - frame-id=1 - length=803 bytes
[ 1][ 9.368787] <1> Process SPOE Message 'mirror'
[ 1][ 9.368788] <1> 5 arg(s) expected
[ 1][ 9.368790] <1> mirror[0] name='arg_method' type=8: "GET"
[ 1][ 9.368792] <1> mirror[1] name='arg_path' type=8: "https://sub.domain.net/ready"
[ 1][ 9.368793] <1> mirror[2] name='arg_ver' type=8: "2.0"
[ 1][ 9.368801] <1> mirror[3] name='arg_hdrs' type=9: <0a757365722d6167656e744c4d6f7a696c6c612f352e3020285831313b205562756e74753b204c696e7578207838365f36343b2072763a38382e3029204765636b6f2f32303130303130312046697265666f782f38382e30066163636570744a746578742f68746d6c2c6170706c69636174696f6e2f7868746d6c2b786d6c2c6170706c69636174696f6e2f786d6c3b713d302e392c696d6167652f776562702c2a2f2a3b713d302e380f6163636570742d6c616e67756167650e656e2d55532c656e3b713d302e350f6163636570742d656e636f64696e6711677a69702c206465666c6174652c20627203646e74013119757067726164652d696e7365637572652d7265717565737473013102746508747261696c65727304686f73741568612d617a7572652e6469636f64696e672e6e657406636f6f6b6965fa085f67636c5f61753d312e312e3335363431343133322e313632303632393530343b206c61726176656c5f73657373696f6e3d65794a7064694936496c68455357744d5332747156325a71536d45794d564a32566d73725a6b453950534973496e5a686248566c496a6f69517a4250553252446332684f4e48423255317035633068514d6d6b345a55784c54444677546e426c4b7a4273626a4a7859564631517974614e3046354b31684c59304a68596b4d30646d5130516d6b79565539455a57317251324e56556c5646544670464d6b55774d6d5676546d3032566d633950534973496d316859794936496a6379597a4d344d3249354e544d784d324d314f544e6b5932517a4d7a45774e544a695a6a4e6c4e7a526c4d7a566a4d54646b5a474d7a596d5a6c4f5445775a6a51305a544934593252685a44566b4e4759774e54556966512533442533443b205f66775f63726d5f763d31616135306363622d346663372d346132342d666238642d6462326166316338336666370000> <.user-agentLMozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0.acceptJtext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8.accept-language.en-US,en;q=0.5.accept-encoding.gzip, deflate, br.dnt.1.upgrade-insecure-requests.1.te.trailers.host.sub.domain.net.cookie.._gcl_au=1.1.356414132.1620629504; laravel_session=eyJpdiI6IlhESWtMS2tqV2ZqSmEyMVJ2VmsrZkE9PSIsInZhbHVlIjoiQzBPU2RDc2hONHB2U1p5c0hQMmk4ZUxLTDFwTnBlKzBsbjJxYVF1QytaN0F5K1hLY0JhYkM0dmQ0QmkyVU9EZW1rQ2NVUlVFTFpFMkUwMmVvTm02Vmc9PSIsIm1hYyI6IjcyYzM4M2I5NTMxM2M1OTNkY2QzMzEwNTJiZjNlNzRlMzVjMTdkZGMzYmZlOTEwZjQ0ZTI4Y2RhZDVkNGYwNTUifQ%3D%3D; _fw_crm_v=1aa50ccb-4fc7-4a24-fb8d-db2af1c83ff7..>
[ 1][ 9.368803] <1> str[0]: <user-agent>
[ 1][ 9.368814] <1> str[1]: <Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0>
[ 1][ 9.368816] <1> header[0]: <user-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0>
[ 1][ 9.368816] <1> str[2]: <accept>
[ 1][ 9.368829] <1> str[3]: <text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8>
[ 1][ 9.368859] <1> header[1]: <accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8>
[ 1][ 9.368860] <1> str[4]: <accept-language>
[ 1][ 9.368877] <1> str[5]: <en-US,en;q=0.5>
[ 1][ 9.368878] <1> header[2]: <accept-language: en-US,en;q=0.5>
[ 1][ 9.368878] <1> str[6]: <accept-encoding>
[ 1][ 9.368884] <1> str[7]: <gzip, deflate, br>
[ 1][ 9.368885] <1> header[3]: <accept-encoding: gzip, deflate, br>
[ 1][ 9.368885] <1> str[8]: <dnt>
[ 1][ 9.368891] <1> str[9]: <1>
[ 1][ 9.368892] <1> header[4]: <dnt: 1>
[ 1][ 9.368893] <1> str[10]: <upgrade-insecure-requests>
[ 1][ 9.368901] <1> str[11]: <1>
[ 1][ 9.368902] <1> header[5]: <upgrade-insecure-requests: 1>
[ 1][ 9.368903] <1> str[12]: <te>
[ 1][ 9.368910] <1> str[13]: <trailers>
[ 1][ 9.368910] <1> header[6]: <te: trailers>
[ 1][ 9.368911] <1> str[14]: <host>
[ 1][ 9.368917] <1> str[15]: <sub.domain.net>
[ 1][ 9.368918] <1> header[7]: <host: sub.domain.net>
[ 1][ 9.368918] <1> str[16]: <cookie>
[ 1][ 9.368924] <1> str[17]: <_gcl_au=1.1.356414132.1620629504; laravel_session=eyJpdiI6IlhESWtMS2tqV2ZqSmEyMVJ2VmsrZkE9PSIsInZhbHVlIjoiQzBPU2RDc2hONHB2U1p5c0hQMmk4ZUxLTDFwTnBlKzBsbjJxYVF1QytaN0F5K1hLY0JhYkM0dmQ0QmkyVU9EZW1rQ2NVUlVFTFpFMkUwMmVvTm02Vmc9PSIsIm1hYyI6IjcyYzM4M2I5NTMxM2M1OTNkY2QzMzEwNTJiZjNlNzRlMzVjMTdkZGMzYmZlOTEwZjQ0ZTI4Y2RhZDVkNGYwNTUifQ%3D%3D; _fw_crm_v=1aa50ccb-4fc7-4a24-fb8d-db2af1c83ff7>
[ 1][ 9.368925] <1> header[8]: <cookie: _gcl_au=1.1.356414132.1620629504; laravel_session=eyJpdiI6IlhESWtMS2tqV2ZqSmEyMVJ2VmsrZkE9PSIsInZhbHVlIjoiQzBPU2RDc2hONHB2U1p5c0hQMmk4ZUxLTDFwTnBlKzBsbjJxYVF1QytaN0F5K1hLY0JhYkM0dmQ0QmkyVU9EZW1rQ2NVUlVFTFpFMkUwMmVvTm02Vmc9PSIsIm1hYyI6IjcyYzM4M2I5NTMxM2M1OTNkY2QzMzEwNTJiZjNlNzRlMzVjMTdkZGMzYmZlOTEwZjQ0ZTI4Y2RhZDVkNGYwNTUifQ%3D%3D; _fw_crm_v=1aa50ccb-4fc7-4a24-fb8d-db2af1c83ff7>
[ 1][ 9.368926] <1> str[18]: <>
[ 1][ 9.368927] <1> mirror[4] name='arg_body' type=9: <(null)> <(null)>
[ 1][ 9.369004] "GET https://mirror.domain.net:443https://sub.domain.net/ready HTTP/???" 0 0/0 0.000 Port number ended with 'h'
[ 1][ 9.369029] <1> <-- ACK encoding frame
[ 1][ 9.369031] <1> <-- ACK stream-id=667690 - frame-id=1
[ 1][ 9.369036] <1:26> <-- Sending data
[ 1][ 9.369058] <1:26> 4/4/4 byte(s) send frame length
[ 1][ 9.369063] <1:26> 10/10/10 byte(s) send frame data
[ 1][ 9.369064] <1:26> Frame of 10 bytes sent: <6700000001faf3c40101> <g.........>
[ 1][ 14.370290] <1:26> --> Receiving data
[ 1][ 14.370307] <1:26> 4/4/4 byte(s) received frame length
[ 1][ 14.370311] <1:26> 49/49/49 byte(s) received frame data
[ 1][ 14.370314] <1:26> New frame of 49 bytes received: <020000000100000b7374617475732d636f64650302076d6573736167650812612074696d656f7574206f63637572726564> <........status-code...message..a timeout occurred>
[ 1][ 14.370316] <1> --> HAPROXY-DISCONNECT decoding frame
[ 1][ 14.370318] <1> --> HAPROXY-DISCONNECT header 2 0x01000000 0 0
[ 1][ 14.370320] <1> --> HAPROXY-DISCONNECT stream-id=0 - frame-id=0
[ 1][ 14.370322] <1> K/V item: key=status-code
[ 1][ 14.370325] <1> --> HAPROXY-DISCONNECT status code: 2 (a timeout occurred)
[ 1][ 14.370327] <1> K/V item: key=message
[ 1][ 14.370328] <1> --> HAPROXY-DISCONNECT message: a timeout occurred
[ 1][ 14.370329] <1> <-- AGENT-DISCONNECT encoding frame
[ 1][ 14.370332] <1> <-- AGENT-DISCONNECT stream-id=0 - frame-id=0
[ 1][ 14.370333] <1> <-- AGENT-DISCONNECT status code: 0
[ 1][ 14.370334] <1> <-- AGENT-DISCONNECT message: normal
[ 1][ 14.370341] <1:26> <-- Sending data
[ 1][ 14.370392] <1:26> 4/4/4 byte(s) send frame length
[ 1][ 14.370438] <1:26> 37/37/37 byte(s) send frame data
[ 1][ 14.370441] <1:26> Frame of 37 bytes sent: <660000000100000b7374617475732d636f64650300076d65737361676508066e6f726d616c> <f.......status-code...message..normal>
[ 1][ 14.370442] <1:26> Release client
Spoa mirror version
spoa-mirror v1.2.13 [build 2432] by Miroslav Zagorac <mzagorac@haproxy.com>, May 6 2021
Hi, i have an issue, my mirror url is merging with the original url, as you can see in spoa mirror debug log.
"GET https://mirror.domain.net:443https://sub.domain.net/ready HTTP/???" 0 0/0 0.000 Port number ended with 'h'
when run spoa mirror agent without port included
sudo spoa-mirror --runtime 0 --mirror-url "https://mirror.domain.net" --logfile w:/var/log/haproxy-mirror.logs
I got this
"GET https://mirror.domain.nethttps://sub.domain.net/ready HTTP/???" 0 0/0 65.088 Could not resolve host: mirror.domain.nethttps
I have followed https://www.haproxy.com/blog/haproxy-traffic-mirroring-for-real-world-testing but dont know, whats wrong
same issue
Hello all,
in spoe configuration file (here it is mirror.conf) instead of 'arg_path=url' put 'arg_path=path'. I don't know why the content of the 'url' sample differs in this case, but this way you can help yourself. For details why this is so, you can ask on the haproxy mailing list, there are people there who can explain it to you in detail. :)