├── .gitignore ├── README.md ├── main.go ├── parity-proxy-darwin-amd64 └── parity-proxy-linux-amd64 /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | parity-proxy 2 | ============ 3 | 4 | Sets `Content-Type: application/json` and `Accept: application/json` 5 | header 6 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | "net/http/httputil" 8 | "net/url" 9 | "os" 10 | ) 11 | 12 | func main() { 13 | port := os.Getenv("PORT") 14 | origin, err := url.Parse(os.Getenv("ORIGIN_URL")) 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | director := func(req *http.Request) { 20 | req.Header.Set("Accept", "application/json") 21 | req.Header.Set("Content-Type", "application/json") 22 | req.Header.Add("X-Forwarded-Host", req.Host) 23 | req.Header.Add("X-Origin-Host", origin.Host) 24 | req.URL.Scheme = origin.Scheme 25 | req.URL.Host = origin.Host 26 | } 27 | 28 | proxy := &httputil.ReverseProxy{Director: director} 29 | 30 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 31 | proxy.ServeHTTP(w, r) 32 | }) 33 | 34 | log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) 35 | } 36 | -------------------------------------------------------------------------------- /parity-proxy-darwin-amd64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoinbaseWallet/parity-proxy/c9cd761c4a12e23be207dd277c986d3e3bc8b8a8/parity-proxy-darwin-amd64 -------------------------------------------------------------------------------- /parity-proxy-linux-amd64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoinbaseWallet/parity-proxy/c9cd761c4a12e23be207dd277c986d3e3bc8b8a8/parity-proxy-linux-amd64 --------------------------------------------------------------------------------