This is a basic HTTP proxy server written in Go that logs all incoming HTTP requests. It captures essential details like the request method, URL, and headers, making it a useful starting point for learning about networking, proxying, and logging in Go.
- Forwards HTTP requests to their destination.
- Logs request details (method, URL, headers).
- Simple and lightweight, perfect for beginners.
Ensure you have Go installed (version 1.18 or higher recommended). You can download it from golang.org.
git clone https://github.com/vitorsv1/go-proxy.git
cd go-proxy
go run main.go
By default, the proxy listens on port 8080.
- Browser: Set
localhost:8080
as your HTTP proxy. - Curl: Use the proxy in requests:
curl -x http://localhost:8080 http://example.com
- cmd/
- main.go
- internal/
- proxy/
- proxy.go
- logger.go
- filter.go
- config/
- config.go
- proxy/
- logs/
- tests/
- go.mod
- README.md
Here are some enhancements you can add:
- Support for HTTPS requests
- Implement domain blocklisting
- Save logs to a file instead of printing to the console