This project implements a simple reverse proxy with round-robin load balancing in Go. It distributes incoming HTTP requests evenly across multiple backend servers.
- HTTP reverse proxy
- Round-robin load balancing between backend servers
- Built using Go's standard net/http/httputilpackage
- Easily extensible to add caching, rate limiting, and more
- Go installed (version 1.16+ recommended)
- Two or more backend HTTP servers running for testing (see example below)
- 
Clone or download this repository. 
- 
Start backend servers. For example, create two simple servers like: // server.go package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello from backend server at %s!", r.Host) }) log.Println("Starting backend server on :8081") log.Fatal(http.ListenAndServe(":8081", nil)) } Run this code twice with different ports ( :8081and:8082), e.g.:go run server1.go # runs on :8081 go run server2.go # runs on :8082 
- 
Run the reverse proxy: go run main.go 
- 
Access the proxy in your browser or via curl: http://localhost:8080/Requests will be forwarded in a round-robin manner between your backend servers. 
- The proxy listens on port 8080.
- Incoming requests are distributed to backend servers (8081,8082, etc.) one by one.
- Uses httputil.NewSingleHostReverseProxyto forward requests and responses.
- Add caching layer
- Implement rate limiting
- Support HTTPS / TLS
- More detailed logging and error handling
This project is licensed under the MIT License.