Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
1040f21ca6
8
env.yaml
8
env.yaml
|
@ -5,3 +5,11 @@ username: ...
|
|||
password: ...
|
||||
namespace: fs_server_api_dev
|
||||
group: FS-SERVER-API
|
||||
|
||||
proxyserver:
|
||||
key: /opt/server.dev.fusenpack.com.key
|
||||
pem: /opt/server.dev.fusenpack.com.pem
|
||||
|
||||
serverbackend:
|
||||
key: /opt/serverbackend.dev.fusenpack.com.key
|
||||
pem: /opt/serverbackend.dev.fusenpack.com.pem
|
|
@ -97,6 +97,7 @@ func main() {
|
|||
indexHtmlPath := vueBuild + "/index.html"
|
||||
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.URL.Path, "/api/") {
|
||||
|
||||
err := r.ParseMultipartForm(100 << 20)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
|
@ -104,6 +105,17 @@ func main() {
|
|||
|
||||
// 对/api开头的请求进行反向代理
|
||||
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
||||
proxy.ErrorHandler = func(res http.ResponseWriter, req *http.Request, err error) {
|
||||
if err != nil {
|
||||
// 在发生错误时进行处理
|
||||
logx.Error(err)
|
||||
res.WriteHeader(http.StatusNotFound) // 返回404状态码
|
||||
_, err := res.Write([]byte(err.Error()))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
Port: 9907
|
||||
Timeout: 15000 #服务超时时间(毫秒)
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
SourceRabbitMq:
|
||||
SourceRabbitMq: 213
|
||||
Log:
|
||||
Stat: false
|
||||
Auth:
|
||||
|
|
Loading…
Reference in New Issue
Block a user