goreplay
goreplay copied to clipboard
Rewrite multi header can't work?
I use gor1.3.3 wget https://github.com/buger/goreplay/releases/download/1.3.3/gor_1.3.3_x64.tar.gz
gor record traffic like this:
or like this:

I want to rewrite header: authorization and authorization-virtual.
using
--http-rewrite-header 'authorization: XDS [a-zA-Z0-9.-_/+/-]+,xxx' --http-rewrite-header 'authorization-virtual: VDS [a-zA-Z0-9.-_/+/-]+,VDS xxx'
authorization can be rewrited. But authorization-virtual can't be rewrited
There is a bug here.
if len(m.config.HeaderRewrite) > 0 {
for _, f := range m.config.HeaderRewrite {
value := proto.Header(payload, f.header)
if len(value) == 0 {
break <<<<<<<<<< if header "authorization" is not found, it will not try the left "authorization-virtual"
}
if f.src.Match(value) {
newValue := f.src.ReplaceAll(value, f.target)
payload = proto.SetHeader(payload, f.header, newValue)
}
}
}
I will submit a fix for this.