mirror of https://github.com/portainer/portainer
fix(networking): convert from localhost addresses to 127.0.0.1 (#3411)
parent
3d5bdab620
commit
b2f36a3bbe
|
@ -179,7 +179,7 @@ func (service *Service) snapshotEnvironment(endpointID portainer.EndpointID, tun
|
||||||
}
|
}
|
||||||
|
|
||||||
endpointURL := endpoint.URL
|
endpointURL := endpoint.URL
|
||||||
endpoint.URL = fmt.Sprintf("tcp://localhost:%d", tunnelPort)
|
endpoint.URL = fmt.Sprintf("tcp://127.0.0.1:%d", tunnelPort)
|
||||||
snapshot, err := service.snapshotter.CreateSnapshot(endpoint)
|
snapshot, err := service.snapshotter.CreateSnapshot(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -81,7 +81,7 @@ func createEdgeClient(endpoint *portainer.Endpoint, reverseTunnelService portain
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel := reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
tunnel := reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
||||||
endpointURL := fmt.Sprintf("http://localhost:%d", tunnel.Port)
|
endpointURL := fmt.Sprintf("http://127.0.0.1:%d", tunnel.Port)
|
||||||
|
|
||||||
return client.NewClientWithOpts(
|
return client.NewClientWithOpts(
|
||||||
client.WithHost(endpointURL),
|
client.WithHost(endpointURL),
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (manager *SwarmStackManager) prepareDockerCommandAndArgs(binaryPath, dataPa
|
||||||
endpointURL := endpoint.URL
|
endpointURL := endpoint.URL
|
||||||
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
||||||
tunnel := manager.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
tunnel := manager.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
||||||
endpointURL = fmt.Sprintf("tcp://localhost:%d", tunnel.Port)
|
endpointURL = fmt.Sprintf("tcp://127.0.0.1:%d", tunnel.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, "-H", endpointURL)
|
args = append(args, "-H", endpointURL)
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
func (handler *Handler) proxyEdgeAgentWebsocketRequest(w http.ResponseWriter, r *http.Request, params *webSocketRequestParams) error {
|
func (handler *Handler) proxyEdgeAgentWebsocketRequest(w http.ResponseWriter, r *http.Request, params *webSocketRequestParams) error {
|
||||||
tunnel := handler.ReverseTunnelService.GetTunnelDetails(params.endpoint.ID)
|
tunnel := handler.ReverseTunnelService.GetTunnelDetails(params.endpoint.ID)
|
||||||
|
|
||||||
endpointURL, err := url.Parse(fmt.Sprintf("http://localhost:%d", tunnel.Port))
|
endpointURL, err := url.Parse(fmt.Sprintf("http://127.0.0.1:%d", tunnel.Port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (factory *ProxyFactory) newDockerLocalProxy(endpoint *portainer.Endpoint) (
|
||||||
func (factory *ProxyFactory) newDockerHTTPProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
|
func (factory *ProxyFactory) newDockerHTTPProxy(endpoint *portainer.Endpoint) (http.Handler, error) {
|
||||||
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
||||||
tunnel := factory.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
tunnel := factory.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
||||||
endpoint.URL = fmt.Sprintf("http://localhost:%d", tunnel.Port)
|
endpoint.URL = fmt.Sprintf("http://127.0.0.1:%d", tunnel.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
endpointURL, err := url.Parse(endpoint.URL)
|
endpointURL, err := url.Parse(endpoint.URL)
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (manager *ComposeStackManager) createClient(endpoint *portainer.Endpoint) (
|
||||||
endpointURL := endpoint.URL
|
endpointURL := endpoint.URL
|
||||||
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
if endpoint.Type == portainer.EdgeAgentEnvironment {
|
||||||
tunnel := manager.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
tunnel := manager.reverseTunnelService.GetTunnelDetails(endpoint.ID)
|
||||||
endpointURL = fmt.Sprintf("tcp://localhost:%d", tunnel.Port)
|
endpointURL = fmt.Sprintf("tcp://127.0.0.1:%d", tunnel.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
clientOpts := client.Options{
|
clientOpts := client.Options{
|
||||||
|
|
|
@ -953,7 +953,7 @@ const (
|
||||||
// to be used when communicating with an agent
|
// to be used when communicating with an agent
|
||||||
PortainerAgentSignatureMessage = "Portainer-App"
|
PortainerAgentSignatureMessage = "Portainer-App"
|
||||||
// ExtensionServer represents the server used by Portainer to communicate with extensions
|
// ExtensionServer represents the server used by Portainer to communicate with extensions
|
||||||
ExtensionServer = "localhost"
|
ExtensionServer = "127.0.0.1"
|
||||||
// DefaultEdgeAgentCheckinIntervalInSeconds represents the default interval (in seconds) used by Edge agents to checkin with the Portainer instance
|
// DefaultEdgeAgentCheckinIntervalInSeconds represents the default interval (in seconds) used by Edge agents to checkin with the Portainer instance
|
||||||
DefaultEdgeAgentCheckinIntervalInSeconds = 5
|
DefaultEdgeAgentCheckinIntervalInSeconds = 5
|
||||||
// LocalExtensionManifestFile represents the name of the local manifest file for extensions
|
// LocalExtensionManifestFile represents the name of the local manifest file for extensions
|
||||||
|
|
Loading…
Reference in New Issue