nacos config
This commit is contained in:
parent
e925d8c684
commit
2d224c0d67
|
@ -18,7 +18,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
_ "fusenapi/utils/auth"
|
_ "fusenapi/utils/auth"
|
||||||
|
@ -105,16 +104,16 @@ func main() {
|
||||||
|
|
||||||
// 对/api开头的请求进行反向代理
|
// 对/api开头的请求进行反向代理
|
||||||
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
proxy := httputil.NewSingleHostReverseProxy(apiURL)
|
||||||
proxy.ErrorHandler = func(res http.ResponseWriter, req *http.Request, err error) {
|
// proxy.ErrorHandler = func(res http.ResponseWriter, req *http.Request, err error) {
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
|
|
||||||
// 在发生错误时进行处理
|
// // 在发生错误时进行处理
|
||||||
log.Println(res.Header())
|
// log.Println(res.Header())
|
||||||
logx.Info(err)
|
// logx.Info(err)
|
||||||
logx.Info(res.Header())
|
// logx.Info(res.Header())
|
||||||
res.WriteHeader(http.StatusNotFound) // 返回404状态码
|
// res.WriteHeader(http.StatusNotFound) // 返回404状态码
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
proxy.ServeHTTP(w, r)
|
proxy.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user