Skip to content

A simple but powerful http & websocket reverse proxy written in Go

License

Notifications You must be signed in to change notification settings

AaronO/gogo-proxy

Repository files navigation

gogo-proxy

A fast and robust http/websocket reverse proxy library written in Go

Features

  • Simple:
    • Implements http.Handler interface
    • Easy to write Balancers for custom routing logic
    • Built-in balancing patterns (Roundrobin, Random, etc ...)
  • 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 as redis, memcache, etcd, mysql, ...
  • Fast & "scalable":
    • Written in go, so concurrent by default and fast
    • Easy to deploy (proxies can be compiled as single binaries)

Example

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)
}

Acknowledgements

About

A simple but powerful http & websocket reverse proxy written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages