|
|
package mobile_client
|
|
|
|
|
|
import (
|
|
|
"bytes"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
"net/http/httputil"
|
|
|
"net/url"
|
...
|
...
|
@@ -33,10 +31,9 @@ func (controller *ReverseProxyController) SuplusSaleApp() { |
|
|
if err != nil {
|
|
|
panic(err)
|
|
|
}
|
|
|
controller.Ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(controller.Ctx.Input.RequestBody))
|
|
|
controller.Ctx.Request.URL.Path = strings.Replace(controller.Ctx.Request.URL.Path, "/suplus-sale-app", "", 1)
|
|
|
targetQuery := target.RawQuery
|
|
|
director := func(req *http.Request) {
|
|
|
directorFunc := func(req *http.Request) {
|
|
|
req.Host = target.Host
|
|
|
req.URL.Scheme = target.Scheme
|
|
|
req.URL.Host = target.Host
|
...
|
...
|
@@ -51,7 +48,7 @@ func (controller *ReverseProxyController) SuplusSaleApp() { |
|
|
req.Header.Set("User-Agent", "")
|
|
|
}
|
|
|
}
|
|
|
newProxy := &httputil.ReverseProxy{Director: director}
|
|
|
newProxy := &httputil.ReverseProxy{Director: directorFunc}
|
|
|
newProxy.ServeHTTP(controller.Ctx.ResponseWriter, controller.Ctx.Request)
|
|
|
}
|
|
|
|
...
|
...
|
|