microsoftarchive / moxy

Licence: other
a multi-host reverse proxy for golang

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to moxy

night-shift
A micro-framework to build data processing workflows with GNU Make
Stars: ✭ 14 (-58.82%)
Mutual labels:  wunderlist
WunderHabit
Level up in Habitica by completing todo's in Wunderlist.
Stars: ✭ 36 (+5.88%)
Mutual labels:  wunderlist
tod0
A Terminal Client for Microsoft To-Do
Stars: ✭ 93 (+173.53%)
Mutual labels:  wunderlist
Ao
Elegant Microsoft To-Do desktop app
Stars: ✭ 1,923 (+5555.88%)
Mutual labels:  wunderlist
changelog
Wunderlist Release Notes
Stars: ✭ 54 (+58.82%)
Mutual labels:  wunderlist
wunderlist-api
📕 Wunderlist in a simple way.
Stars: ✭ 11 (-67.65%)
Mutual labels:  wunderlist
wlist
A command line client for Wunderlist
Stars: ✭ 39 (+14.71%)
Mutual labels:  wunderlist
hamustro
Hamustro - the collector of events.
Stars: ✭ 14 (-58.82%)
Mutual labels:  wunderlist

Moxy - A multi-host reverse proxy for golang

Build Status

The stdlib ReverseProxy from net/http/httputil has 2 issues that this project solves

  1. There is single host proxy provided by NewSingleHostReverseProxy, but there is nothing to create a multi-host proxy
  2. While it's possible to process a request before sending it to the proxy, the standard proxy doesn't provide a way to process the proxy response before flushing it out to the clients.

moxy aims to solve both of these problems by

  1. Providing moxy.NewReverseProxy, that supports load-balancing across multiple hosts
  2. Adding suppport for moxy.FilterFunc, a chain of functions that run over the proxy response & optionally make changes to it, before sending it back to the clients.

Example (using negroni)

package main

import (
  "github.com/codegangsta/negroni"
  "github.com/gorilla/mux"
  "github.com/wunderlist/moxy"
  "net/http"
)

func AddSecurityHeaders(request *http.Request, response *http.Response) {
  response.Header.Del("X-Powered-By")
  response.Header.Set("X-Super-Secure", "Yes!!")
}

func main() {

  hosts := []string{"dynamic.host.com"}
  filters := []moxy.FilterFunc{AddSecurityHeaders}
  proxy := moxy.NewReverseProxy(hosts, filters)

  router := mux.NewRouter()
  router.HandleFunc("/resource1", proxy.ServeHTTP)
  router.HandleFunc("/resource2", proxy.ServeHTTP)

  app := negroni.New()
  app.UseHandler(router)
  app.Run(":3009")
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].