Skip to content
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

how to set proxy while replaying #519

Closed
salomon1184 opened this issue Sep 25, 2017 · 13 comments
Closed

how to set proxy while replaying #519

salomon1184 opened this issue Sep 25, 2017 · 13 comments

Comments

@salomon1184
Copy link

salomon1184 commented Sep 25, 2017

I‘d like to replay http request to target web server,meanwhile set proxy to a fuzz proxy(just like fiddler)to gernerate some bad requests, but goreplay seems not support setting http proxy, is there a plan to support this situation?

@buger
Copy link
Owner

buger commented Sep 25, 2017

You can try set proxy via HTTP_PROXY environment variable like this: export HTTP_PROXY="http://proxyIp:proxyPort"

GoReplay itself has no any specific support for proxies, but underlying Go network stack should respect ENV variable mentioned above.

@salomon1184
Copy link
Author

I have tried, but It doesn't seem work.

@mattrobenolt
Copy link
Contributor

Just to chime in here, HTTP_PROXY definitely doesn't work because gor uses it's own HTTP client. The HTTP_PROXY support in native Go, is a part of the HTTP transport, which isn't leveraged here. It's not a network/tcp level thing, it's a change to the way HTTP requests are formed and sent.

https://github.com/buger/goreplay/blob/master/http_client.go#L86-L106

I'm looking to add this in a fork, just something hacky to make it work for my use case.

@zhizouxiao
Copy link

There is way to do it which is kind of trickey. you can request the proxy with modified header. For example, goreplay --input-file "requests.gor" --output-http http://proxy_host:proxy_port/request_path -http-set-header "Host:request_host"

@nagendra547
Copy link

I am also facing the same problem. Looks like goreplay is not following the http proxy set in environment.

@nagendra547
Copy link

nagendra547 commented Feb 22, 2019

@mattrobenolt How did you make it work with your fix? Did you replay like this? It didn't workout for me.

http_proxy=http://proxy_server:proxy_port
https_proxy=http://proxy_server:proxy_port

./gor --input-file file.log --output-stdout --output-http destination-host:80 --output-http-track-response

@mattrobenolt
Copy link
Contributor

@nagendra547 I forked goreplay and added support for it.

See: https://github.com/mattrobenolt/goreplay/tree/http-proxy

I used this in a production setting just fine without any issues.

@buger
Copy link
Owner

buger commented Feb 22, 2019

@mattrobenolt love it! Can you create a pull request?

Thank you!

@mattrobenolt
Copy link
Contributor

@buger #655 enjoy. :)

@nagendra547
Copy link

@mattrobenolt Thanks ! Let me try it out. For building the binaries are you using this step mentioned

https://github.com/buger/goreplay/wiki/Compilation

Or building in some different way?

@mattrobenolt
Copy link
Contributor

Yeah, it would have been that. It's been a while, but that seems right.

@nagendra547
Copy link

Thanks @mattrobenolt . Worked like a charm! :)

@buger
Copy link
Owner

buger commented Feb 23, 2019

Just released RC2 with this change https://github.com/buger/goreplay/releases/tag/v1.0-rc2

@buger buger closed this as completed Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants