The White House signaled Tuesday that President Trump will sign a controversial bill rolling back Obama-era internet privacy rules, drawing the ire of online advocates who said he is failing his first major drain-the-swamp test by allowing broadband companies to sell users’ personal browsing histories.

The Senate passed the bill last week, and it cleared the House Tuesday on a 215-205 vote, meaning it now goes straight to Mr. Trump.

The bill would revoke an October ruling issued by the Federal Communications Commission that imposed tight restrictions on how broadband companies — also known as internet service providers, or ISPs — are able to handle their users’ information. Under the FCC’s rule, companies had to get their customers to opt in before their data could be sold.

If Mr. Trump follows through on signing the bill, consumers would still be allowed to opt out, but they would have to do so explicitly, and advocates said companies could impose a surcharge on people who wanted their data kept secret.

“This is staggering. This is almost a surrender,” said House Minority Leader Nancy Pelosi. “If the Republicans are allowed to do this, we have surrendered all thoughts of privacy for the American people.”

All 215 “yes” votes Tuesday came from Republicans, while all Democrats present voted against the bill in the House, as did 15 Republicans.

Beneath the very public fight over privacy is a battle for supremacy between broadband providers like Comcast, Verizon and AT&T on the one hand, and the big popular websites such as Google and Facebook, known in the industry as “edge providers.”

All of them want access to Americans’ data, which is highly valued by advertisers.

Under the FCC’s rules, the websites would still be able to collect and sell the information users sent them. But the broadband providers would have faced restrictions.

Republicans said repealing the FCC rule was a matter of fairness, saying the government shouldn’t be picking economic winners and losers in the technology market, and consumers can negotiate with their ISPs.

“With all due respect, the internet was not broken and did not need the federal government to come in and try to protect it,” said Rep. Steve Scalise, Louisiana Republican.

Democrats, however, said repealing the FCC rules means a race to the bottom, freeing all technology companies to collect and sell whatever information they can glean.

They predicted payback from angry internet users.

“My phones are ringing off the hook,” said Rep. Jerry McNerney, California Democrat. “Why are you pushing this? Americans don’t want it, and your voters are just beginning to pay attention.”

Reddit, one of the largest active internet communities, rallied against the GOP’s moves, and users pleaded with Mr. Trump to step in and veto the bill.

“Alright President Trump, you can go ahead and ‘drain the swamp’ now,” said one user who went by the name undergroundsounds.

Some Reddit users said if the privacy protections are revoked, they would pool their money to try to buy the browsing histories of key Republican lawmakers.

Internet privacy advocates said Republicans’ push even violated their own policies. The Electronic Frontier Foundation said Sen. Jeff Flake, the chief sponsor of the bill, has privacy protections on his own congressional website.

“If you’re a U.S. lawmaker, protecting privacy doesn’t just mean avoiding collecting their data when they visit your website. It means standing up for users’ rights every day on Capitol Hill — the exact opposite of which is to roll back the strong privacy protections already on the books,” the EFF said in a blog post this week.

The issue of ISP privacy arose in the latter years of the Obama administration, when the FCC claimed the power to control broadband companies as a common carrier. Republicans said the FCC was stealing power from the FTC, which the GOP said was the correct place to patrol online privacy.

After claiming powers under the common carrier statute, the FCC then issued the privacy rules in October 2016.

Because that rule came late in the tenure of a lame-duck president, it gave Republicans the chance to use the Congressional Review Act.