A simple HTTP proxy server built with Fiber in Go. This app exposes a single /proxy endpoint that forwards HTTP requests to a target URL, acting as a programmable proxy. It is useful for debugging, testing, or as a lightweight API gateway.
- Accepts any HTTP method (GET, POST, PUT, DELETE)
- Forwards headers and body to the target URL
- Returns the proxied response
- Simple validation and error handling
- Go 1.18+
Clone the repository and install dependencies:
git clone https://github.com/ochom/proxy-man.git
cd proxy-man
go mod tidyRun the server:
go run main.goThe server will start on the default Fiber port (3000). You can change the port in the main.go file if needed.
Proxy an HTTP request to a target URL.
{
"method": "GET|POST|PUT|DELETE",
"url": "https://target.url/api",
"headers": { "Header-Name": "value" },
"body": "<raw bytes, optional>"
}method: HTTP method (required)url: Target URL to proxy to (required)headers: Map of headers (optional)body: Raw request body as bytes (optional)
curl -X POST http://localhost:3000/proxy \
-H "Content-Type: application/json" \
-d '{
"method": "GET",
"url": "https://httpbin.org/get",
"headers": {"X-Test": "123"}
}'- On success: Returns the proxied response body as JSON.
- On error: Returns
{ "error": "<error message>" }with status 400.
MIT