fix: 重写 Gitea 反代 Host
This commit is contained in:
@@ -39,7 +39,13 @@ func Handler(facade *Facade, upstreamURL string) (http.Handler, error) {
|
||||
path, service := facade.Handler()
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle(APIBasePath+path, http.StripPrefix(APIBasePath, SPIFFEMiddleware(service)))
|
||||
mux.Handle("/", httputil.NewSingleHostReverseProxy(target))
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
director := proxy.Director
|
||||
proxy.Director = func(request *http.Request) {
|
||||
director(request)
|
||||
request.Host = target.Host
|
||||
}
|
||||
mux.Handle("/", proxy)
|
||||
return mux, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user