Go to file
Simon Vieille 92aa6b341f
ci/woodpecker/push/woodpecker Pipeline is pending Details
Merge branch 'develop'
2023-09-29 15:56:20 +02:00
.dockerignore add build/ in docker ignored files 2023-08-03 18:22:56 +02:00
.gitignore add option to skip TLS verification 2023-08-03 15:42:22 +02:00
.woodpecker.yml fix ci syntax 2023-09-29 15:55:59 +02:00
CHANGELOG.md add option to skip TLS verification 2023-08-03 15:42:22 +02:00
Dockerfile update build 2023-09-01 09:14:29 +02:00
LICENSE add curl button 2018-11-25 13:01:53 -02:00
Makefile rename build binaries 2023-08-03 15:37:42 +02:00
README.md update readme 2023-09-29 15:55:50 +02:00
capture.go add query string in the request log 2023-05-27 18:11:40 +02:00
config.go add option to skip TLS verification 2023-08-03 15:42:22 +02:00
dashboard.html update logo 2023-05-29 11:58:13 +02:00
go.mod allow to use a configuration file 2023-05-29 17:07:39 +02:00
go.sum allow to use a configuration file 2023-05-29 17:07:39 +02:00
main.go add option to skip TLS verification 2023-08-03 15:42:22 +02:00
main_test.go fix tests 2023-08-03 15:44:38 +02:00

README.md

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.

Forked from ofabricio/capture.

status-badge

Running

./capture -url=https://example.com/ -port 9000 -dashboard 9001 -captures 16

Via docker:

docker run -p 9000:9000 -p 9001:9001 deblan/capture -url=https://example.com/ -port 9000 -dashboard 9001 -captures 16

Settings

param description
-url Required. Set the url you want to proxy
-port Set the proxy port. Default: 9000
-dashboard Set the dashboard port. Default: 9001
-captures Set how many captures to show in the dashboard. Default: 16
-tls-skip-verify Skip TLS vertificaton. Default: false
-config Set the configuration file. Default: .capture.ini

You can create a file named .capture.ini and set the configuration inside:

url = https://example.com/
port = 9000
dashboard = 9001
captures = 16
tls_skip_verify = false

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://127.0.0.1:9001/

Preview

dashboard

Building

Manually:

git clone --depth 1 https://gitnet.fr/deblan/capture.git
cd capture
go build

Via docker:

git clone --depth 1 https://gitnet.fr/deblan/capture.git
cd capture
docker run --rm -v $PWD:/src -w /src -e GOOS=darwin -e GOARCH=amd64 golang:alpine go build

Now you have an executable binary in your directory.

Note: change GOOS=darwin to linux or windows to create an executable for your corresponding Operating System.

Plugins

Put plugin files in the current directory. They are loaded sorted by filename on startup.

Plugins must export the following function:

func Handler(proxy http.HandlerFunc) http.HandlerFunc {
    return func(w http.ResponseWriter, r *http.Request) {
        proxy(w, r)
    }
}