So the Rangers have wrapped up home-ice advantage for the first round of the playoffs, everyone in the locker room was speaking of confidence as if it abounds, and, boy, isn’t life jolly?

The reality is that Thursday night at the Garden should have been a wake-up call, a 2-1 win over the league-worst Sabres that was less than two minutes from being an utter embarrassment.

With just 1:42 remaining, the Blueshirts needed Rick Nash to rip a one-timer passed some goalie named Matt Hackett to save face, and now they’ll prepare to play host to either the Flyers or Blue Jackets in the first round next week.

“In a game like tonight, I’m not going to dig too deep in my brain to try and figure it out,” coach Alain Vigneault said. “I’m going to take the two points and move on.”

By getting those two points, and by the Flyers losing 4-2 to the Lightning in Tampa, the Rangers secured second place in the Metropolitan Division, meaning that first-round matchup will start in New York, and could end there, too, if it gets to an ever-anticipated Game 7.

“If we can get home ice, we’d prefer to get it,” Vigneault said before he knew the result of the Flyers’ game. “The higher seed you are, the better off you are.”

The Rangers (45-31-5) spent much of this night dangling over a cliff that could have sent them plummeting with a loss. Without the two points, the possibility of a wild-card spot was still there, meaning a first-round matchup with the Bruins or Penguins.