**Capture** is a reverse proxy that takes an incoming HTTP request and sends it to another server, proxying the response back to the client, while showing them in a dashboard [![Build Status](https://travis-ci.com/ofabricio/capture.svg?branch=master)](https://travis-ci.com/ofabricio/capture) [![Github Release](https://img.shields.io/github/release/ofabricio/capture.svg)](https://github.com/ofabricio/capture/releases) ## Binaries / Executables For ready-to-use executables for *Windows*, *Linux* and *Mac*, see [Releases](https://github.com/ofabricio/capture/releases) page ## Running ./capture -url=https://example.com/ ### Configurations | param | description | |-----------------|-------------| | `-url` | **Required.** Set the url you want to proxy | | `-port` | Set the proxy port. Default: *9000* | | `-dashboard` | Set the dashboard's name. Default: *dashboard* | | `-max-captures` | Set the max number of captures to show in the dashboard. Default: *16* | ## Using If you set your base url as `http://example.com/api`, now `http://localhost:9000` points to that address. Hence, calling `http://localhost:9000/users/1` is like calling `http://example.com/api/users/1` *Capture* saves all requests and responses so that you can see them in the dashboard ## Dashboard To access the dashboard go to `http://localhost:9000/dashboard` The path `/dashboard/**` is reserved, that means if your api has a path like that it will be ignored in favor of the dashboard. However, you can change the dashboard's name with `-dashboard` ##### Preview ![dashboard](https://i.imgur.com/5pbLRRY.png) ## Building Manually: git clone https://github.com/ofabricio/capture.git cd capture go build -o capture . Via docker: git clone https://github.com/ofabricio/capture.git cd capture docker run --rm -v "${PWD}:/src" -w /src -e GOOS=darwin golang:latest go build -o capture . Now you have an executable binary in your directory **Note:** you can change `GOOS=darwin` to `linux` or `windows` ## Plugins Put [plugin](https://golang.org/pkg/plugin/) files in the current directory. They are loaded sorted by filename on startup. Plugins must export the following function: ```go func Handler(proxy http.HandlerFunc) http.HandlerFunc { return func(rw http.ResponseWriter, r *http.Request) { proxy.ServeHTTP(rw, r) } } ```