init
This commit is contained in:
commit
6b2d9cacc4
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
realServer := os.Getenv("REAL_SERVER")
|
||||||
|
listenAddress := os.Getenv("LISTEN_ADDR")
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method == "POST" {
|
||||||
|
b, _ := ioutil.ReadAll(http.NoBody)
|
||||||
|
go http.Post(realServer+r.URL.Path, r.Header.Get("Content-Type"), bytes.NewReader(b))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
http.ListenAndServe(listenAddress, nil)
|
||||||
|
}
|
Loading…
Reference in New Issue