fix(environments): don't override with local IP [EE-1561] (#5785)

fix(environments): don't override with local IP [EE-1561] (#5785)
pull/5891/head
Marcelo Rydel 2021-10-14 09:40:14 -03:00 committed by GitHub
parent 158cdf596a
commit 12e7aa6b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -32,12 +32,13 @@ func (factory *ProxyFactory) newDockerLocalProxy(endpoint *portainer.Endpoint) (
}
func (factory *ProxyFactory) newDockerHTTPProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
rawURL := endpoint.URL
if endpoint.Type == portainer.EdgeAgentOnDockerEnvironment {
tunnel := factory.reverseTunnelService.GetTunnelDetails(endpoint.ID)
endpoint.URL = fmt.Sprintf("http://127.0.0.1:%d", tunnel.Port)
rawURL = fmt.Sprintf("http://127.0.0.1:%d", tunnel.Port)
}
endpointURL, err := url.Parse(endpoint.URL)
endpointURL, err := url.Parse(rawURL)
if err != nil {
return nil, err
}

View File

@ -52,9 +52,9 @@ func (factory *ProxyFactory) newKubernetesLocalProxy(endpoint *portainer.Endpoin
func (factory *ProxyFactory) newKubernetesEdgeHTTPProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
tunnel := factory.reverseTunnelService.GetTunnelDetails(endpoint.ID)
endpoint.URL = fmt.Sprintf("http://localhost:%d", tunnel.Port)
rawURL := fmt.Sprintf("http://localhost:%d", tunnel.Port)
endpointURL, err := url.Parse(endpoint.URL)
endpointURL, err := url.Parse(rawURL)
if err != nil {
return nil, err
}