Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
1b04ac57e5
|
@ -81,6 +81,12 @@ func main() {
|
||||||
fs := http.FileServer(http.Dir(vueBuild))
|
fs := http.FileServer(http.Dir(vueBuild))
|
||||||
indexHtmlPath := vueBuild + "/index.html"
|
indexHtmlPath := vueBuild + "/index.html"
|
||||||
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
|
err := r.ParseMultipartForm(100 << 20)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(r.URL.Path, "/api/") {
|
if strings.HasPrefix(r.URL.Path, "/api/") {
|
||||||
// 对/api开头的请求进行反向代理
|
// 对/api开头的请求进行反向代理
|
||||||
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
||||||
|
@ -144,18 +150,10 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dialer := &websocket.Dialer{
|
|
||||||
Proxy: http.ProxyFromEnvironment,
|
|
||||||
NetDial: func(network, addr string) (net.Conn, error) {
|
|
||||||
return net.Dial(network, addr)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建后端服务对象,包含地址和客户端
|
// 创建后端服务对象,包含地址和客户端
|
||||||
backend := &Backend{
|
backend := &Backend{
|
||||||
HttpAddress: httpAddress,
|
HttpAddress: httpAddress,
|
||||||
Client: client,
|
Client: client,
|
||||||
Dialer: dialer,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建处理请求的函数
|
// 创建处理请求的函数
|
||||||
|
@ -192,6 +190,7 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
|
||||||
header.Del("Sec-Websocket-Key")
|
header.Del("Sec-Websocket-Key")
|
||||||
header.Del("Sec-Websocket-Version")
|
header.Del("Sec-Websocket-Version")
|
||||||
header.Del("Connection")
|
header.Del("Connection")
|
||||||
|
|
||||||
// header.Del("Origin")
|
// header.Del("Origin")
|
||||||
proxyConn, _, err := backend.Dialer.Dial(target.String(), header)
|
proxyConn, _, err := backend.Dialer.Dial(target.String(), header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -22,6 +22,8 @@ run_server() {
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find /tmp/go-build* -mmin +5 -delete
|
||||||
|
|
||||||
# 列出所有服务器目录
|
# 列出所有服务器目录
|
||||||
server_dirs=() # 初始化一个空数组
|
server_dirs=() # 初始化一个空数组
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user