A fast and robust http/websocket reverse proxy library written in Go
- Simple:
- Implements
http.Handler
interface - Easy to write
Balancer
s for custom routing logic - Built-in balancing patterns (
Roundrobin
,Random
, etc ...)
- Implements
- Robust: Retry requests on failure
- Flexible:
- Custom error handling (so you can draw custom error pages etc ...) (use
ErrorHandler
) - Custom request rewriting (use
Rewriter
) - Your
Balancer
lookups can use information from the request, hard coded rules or they can query databases such asredis
,memcache
,etcd
,mysql
, ...
- Custom error handling (so you can draw custom error pages etc ...) (use
- Fast & "scalable":
- Written in go, so concurrent by default and fast
- Easy to deploy (proxies can be compiled as single binaries)
package main
import (
"github.com/AaronO/gogo-proxy"
"net/http"
)
func main() {
p, _ := proxy.New(proxy.ProxyOptions{
Balancer: func(req *http.Request) (string, error) {
return "https://www.google.com", nil
},
})
http.ListenAndServe(":8080", p)
}
- websocketproxy is written by @fatih
- Inspired by loadfire (disclaimer: I wrote this too)