HTTP shadow proxy server written in Go
Go
Latest commit b9acb8a Dec 15, 2013 @kentaro Add travis icon
Permalink
Failed to load latest commit information.
examples
tools
.gitignore More tests Oct 6, 2013
.travis.yml
Gomfile First step to test http server. Oct 6, 2013
README.md Add travis icon Dec 15, 2013
backend.go
handler.go
handler_test.go Fix test Dec 14, 2013
request_body_test.go Send request body to each backends, return master response headers. Dec 14, 2013
response.go Better error messages Dec 12, 2013
server.go
server_test.go

README.md

Delta BuildStatus

Delta is an HTTP shadow proxy server that sits between clients and your server(s) to enable "shadow requests".

It's actually just a Go port of Kage. You can consult the documentation of Kage for reasons why this software matters ;)

Usage

package main

import (
    "github.com/kentaro/delta"
    "log"
    "net/http"
    "time"
)

func main() {
    server := delta.NewServer("0.0.0.0", 8484)

    server.AddMasterBackend("production", "127.0.0.1", 8080)
    server.AddBackend("testing", "127.0.0.1", 8081)

    server.OnSelectBackend(func(req *http.Request) []string {
        if req.Method == "GET" {
            return []string{"production", "testing"}
        } else {
            return []string{"production"}
        }
    })

    server.OnMungeHeader(func(backend string, header *http.Header) {
        if backend == "testing" {
            header.Add("X-Delta-Sandbox", "1")
        }
    })

    server.OnBackendFinished(func(responses map[string]*delta.Response) {
        for backend, response := range responses {
            log.Printf("%s [%d ms]: %s", backend, (response.Elapsed / time.Millisecond), response.Data)
        }
    })

    server.Run()
}

See Also

  • Kage
  • Geest
    • Perl port of Kage
  • Gor
    • It's a tool written in Go to deal with a similar problem

Author

License