Top 3.5% dependent repos on proxy.golang.org
Top 7.4% forks on proxy.golang.org
proxy.golang.org : github.com/abourget/goproxy
Taken from $GOROOT/src/pkg/net/http/chunked needed to write https responses to client. Package goproxy provides a customizable HTTP proxy, supporting hijacking HTTPS connection. The intent of the proxy, is to be usable with reasonable amount of traffic yet, customizable and programable. The proxy itself is simply an `net/http` handler. Typical usage is Adding a header to each request: For printing the content type of all incoming responses Note the use of `ctx.Req` here. The `ctx` holds `Req` and `Resp`. `Resp` can be nil if not available. To print the content type of all responses from a certain url, we'll add a "middleware" before: To invalide responses based on headers for example, you can: We close the body of the original repsonse, and return a new 403 response with a short message. You can catch traffic going through the proxy selectively, and write it to a HAR formatted file with this code: You then "curl http://localhost:8888/har" to provoke a file flush to "/tmp/file.har". Example use cases: 1. https://github.com/abourget/goproxy/tree/master/examples/goproxy-avgsize To measure the average size of an Html served in your site. One can ask all the QA team to access the website by a proxy, and the proxy will measure the average size of all text/html responses from your host. 2. [not yet implemented] All requests to your web servers should be directed through the proxy, when the proxy will detect html pieces sent as a response to AJAX request, it'll send a warning email. 3. https://github.com/abourget/goproxy/blob/master/examples/goproxy-httpdump/ Generate a real traffic to your website by real users using through proxy. Record the traffic, and try it again for more real load testing. 4. https://github.com/abourget/goproxy/tree/master/examples/goproxy-no-reddit-at-worktime Will allow browsing to reddit.com between 8:00am and 17:00pm 5. https://github.com/abourget/goproxy/tree/master/examples/goproxy-jquery-version Will warn if multiple versions of jquery are used in the same domain. 6. https://github.com/abourget/goproxy/blob/master/examples/goproxy-upside-down-ternet/ Modifies image files in an HTTP response via goproxy's image extension found in ext/.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/abourget/goproxy
License: BSD-3-Clause
Latest release: about 8 years ago
First release: about 8 years ago
Namespace: github.com/abourget
Dependent repositories: 2
Stars: 15 on GitHub
Forks: 7 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 29 days ago