|
|
|
@ -56,8 +56,12 @@ func updateURL(route *plugins.AppPluginRoute, orgId int64, appID string) (string |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewApiPluginProxy create a plugin proxy
|
|
|
|
|
func NewApiPluginProxy(ctx *models.ReqContext, proxyPath string, route *plugins.AppPluginRoute, appID string, cfg *setting.Cfg) *httputil.ReverseProxy { |
|
|
|
|
targetURL, _ := url.Parse(route.URL) |
|
|
|
|
func NewApiPluginProxy(ctx *models.ReqContext, proxyPath string, route *plugins.AppPluginRoute, appID string, |
|
|
|
|
cfg *setting.Cfg) (*httputil.ReverseProxy, error) { |
|
|
|
|
targetURL, err := url.Parse(route.URL) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
director := func(req *http.Request) { |
|
|
|
|
req.URL.Scheme = targetURL.Scheme |
|
|
|
@ -115,5 +119,5 @@ func NewApiPluginProxy(ctx *models.ReqContext, proxyPath string, route *plugins. |
|
|
|
|
// log.Tracef("Proxying plugin request: %s", string(reqBytes))
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return &httputil.ReverseProxy{Director: director} |
|
|
|
|
return &httputil.ReverseProxy{Director: director}, nil |
|
|
|
|
} |
|
|
|
|