-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http-rewrite-header and http-set-header rename the existing header when partial name match #965
Comments
I am also interested to know if those scenarios are supported. @buger, can you please comment? Thanks! |
rewrite the value of a header (http-rewrite-header): I noticed that this works in v1.3.0_RC5 |
@anatoly71 does it means that issue is solved for you? |
@buger, thanks for your comment. The issue is solved in the way that I can use the released version 1.3 but.. Unfortunately the version 1.3 has another problem namely it forwards the same request twice on linux. I can close this issue but I still cannot achieve header rewriting.. |
Since 1.3.1 is released, I will close this ticket. Feel free to re-open |
rewriting headers works fine in 1.3.1, thank you. |
Bug or incorrect usage?
Linux, GoReplay 1.1.0
I am trying two scenarios:
For the both scenarios there is a header "HeaderASomething: AAA" in the incoming request. Note the similarity between the names of HeaderASomething and HeaderA.
The outcome in the both scenarios is HeaderASomething from the incoming request becomes an empty header with a mangled name in the forwarded request.
the output of goreplay -h states:
Rewrite the request header based on a mapping:
gor --input-raw :8080 --output-http staging.com --http-rewrite-header Host: (.).example.com,$1.beta.example.com
My expectation here is either a full match or no match for the header name. Or some instructions of how to steer the
matching of the header name (regex?).
The actual behaviour is "HeaderASomething: AAA" from the incoming request becomes an empty header "HeaderASBBB".
Is HeaderASBBB = HeaderAS + BBB?
Please see the example below
on a host testhost goreplay is started:
goreplay -debug -verbose -input-raw :80 -output-http http://someserver/:80/ --http-disallow-url health --http-rewrite-header 'HeaderA:(.*),BBB'
a request is made to testhost:80
curl -X GET "http://testhost/some/path" -H "accept: application/json" -H "HeaderASomething: AAA"
output of goreplay (the incoming request)
[DEBUG][PID 369][Jul 13 14:58:19.149142905][elapsed 84.718µs] [EMITTER] input: 1 34a6276f26b6845b9d50f277456946be5742f0ee 1626188299148988883
GET /some/path HTTP/1.1
Host: testhost
User-Agent: curl/7.64.1
accept: application/json
HeaderASomething: AAA
tcpdump running on testhost (tcpdump -vvAs0 -i eth0 dst host someserver and dst port 80) outputs
the forwarded request with the mangled HeaderASomething
14:59:51.809125 IP (tos 0x0, ttl 64, id 49070, offset 0, flags [DF], proto TCP (6), length 193)
testhost.39894 > someserver.80: Flags [P.], cksum 0x4181 (incorrect -> 0x6b2b), seq 0:153, ack 1, win 55, length 153: HTTP, length: 153
GET /some/path HTTP/1.1
Host: someserverIP
User-Agent: curl/7.64.1
accept: application/json
HeaderASBBB
the output of goreplay -h states:
Inject additional headers to http request:
gor --input-raw :8080 --output-http staging.com --http-set-header 'User-Agent: Gor'
My expectation here is a new header is inserted. If there is a full match for the existing header name then
probably the value is replaced for the matched header.
The actual behavior is "HeaderASomething: AAA" from the incoming request becomes empty header "HeaderASwhatever".
Is HeaderASwhatever = HeaderAS + whatever?
Please see the example below:
on a host testhost goreplay is started:
goreplay -debug -verbose -input-raw :80 -output-http http://someserver/:80/ -http-disallow-url health -http-set-header 'HeaderA: whatever'
a request is made to testhost:80
curl -X GET "http://testhost/some/path" -H "accept: application/json" -H "HeaderASomething: AAA"
output of goreplay (the incoming request)
[DEBUG][PID 433][Jul 13 15:06:12.656579199][elapsed 152.294µs] [EMITTER] input: 1 38fd003766417552eafcb9d1182ca94ca29e84c4 1626188772656372710
GET /some/path HTTP/1.1
Host: testhost
User-Agent: curl/7.64.1
accept: application/json
HeaderASomething: AAA
tcpdump running on testhost (tcpdump -vvAs0 -i eth0 dst host someserver and dst port 80) outputs
the forwarded request with the mangled HeaderASomething header
15:06:12.740177 IP (tos 0x0, ttl 64, id 62871, offset 0, flags [DF], proto TCP (6), length 198)
testhost.50774 > someserver.80: Flags [P.], cksum 0x4186 (incorrect -> 0xc812), seq 0:158, ack 1, win 55, length 158: HTTP, length: 158
GET /some/path HTTP/1.1
Host: someserverIP
User-Agent: curl/7.64.1
accept: application/json
HeaderASwhatever
The text was updated successfully, but these errors were encountered: