diff --git a/server/start.go b/server/start.go index 806656906b60..217cc37a486e 100644 --- a/server/start.go +++ b/server/start.go @@ -401,7 +401,18 @@ func startInProcess(parentCtx context.Context, ctx *Context, clientCtx client.Co maxRecvMsgSize = serverconfig.DefaultGRPCMaxRecvMsgSize } - grpcSrvAddrString := fmt.Sprintf("%s://%s", grpcSrvAddr.Network(), grpcSrvAddr.String()) + var grpcSrvAddrString string + if grpcSrvAddr.Network() == "tcp" { + // Use original cosmos behavior for tcp. + _, port, err := net.SplitHostPort(grpcSrvAddr.String()) + if err != nil { + return err + } + grpcSrvAddrString = fmt.Sprintf("127.0.0.1:%s", port) + } else { + // This can support UDS at the very least. See https://github.com/grpc/grpc/blob/master/doc/naming.md for details. + grpcSrvAddrString = fmt.Sprintf("%s://%s", grpcSrvAddr.Network(), grpcSrvAddr.String()) + } // If grpc is enabled, configure grpc client for grpc gateway. grpcClient, err := grpc.Dial( grpcSrvAddrString,