diff --git a/nomad/client_endpoint.go b/nomad/client_endpoint.go index 8bfc62560..c13cf321b 100644 --- a/nomad/client_endpoint.go +++ b/nomad/client_endpoint.go @@ -21,9 +21,6 @@ func (c *Client) Register(args *structs.RegisterRequest, reply *structs.GenericR defer metrics.MeasureSince([]string{"nomad", "client", "register"}, time.Now()) // Validate the arguments - if args.Region == "" { - return fmt.Errorf("missing region for client registration") - } if args.Node == nil { return fmt.Errorf("missing node for client registration") } diff --git a/nomad/rpc.go b/nomad/rpc.go index d437ebe65..37968e77f 100644 --- a/nomad/rpc.go +++ b/nomad/rpc.go @@ -168,8 +168,12 @@ func (s *Server) handleNomadConn(conn net.Conn) { // forward is used to forward to a remote region or to forward to the local leader // Returns a bool of if forwarding was performed, as well as any error func (s *Server) forward(method string, info structs.RPCInfo, args interface{}, reply interface{}) (bool, error) { - // Handle region forwarding region := info.RequestRegion() + if region == "" { + return true, fmt.Errorf("missing target RPC") + } + + // Handle region forwarding if region != s.config.Region { err := s.forwardRegion(region, method, args, reply) return true, err