The “hidden city” hack has traditionally been one of the best-kept secrets among flyers. It involves strategically ditching the connecting leg of a flight to avoid the higher cost of non-stop flights. It’s a sneaky but effective trick, and while it’s long been frowned upon by airlines, savvy travelers have used it to save money for years.

But now, one of the world’s biggest airlines is seeking to sue a passenger for doing it.

Germany’s flag carrier Lufthansa is demanding payment from a passenger it accused of deliberately buying a ticket with no intention of flying the second leg of the journey.

GET THE FOX NEWS APP

According to The Independent, an initial court case ruled in favor of the passenger but Lufthansa has now been given permission to appeal.

Here's how the "hack" works:

Say you want to fly from London to Hamburg, Germany. Right now, you could get a direct flight from both cities for about $147, according to the booking website Skiplagged. Or, you could book a flight from London to Cologne with a stopover in Hamburg for $109, and simply not board the second leg to Cologne — because the Hamburg was actually your intended final destination.

You’ve traveled the same distance for much less of the price. And the longer the flights, the bigger the potential savings.

'BIG BANG THEORY' ACTRESS SAYS UNITED AIRLINES SHUT GATE IN HER FACE

Airlines are wising up.

Passengers will pay airlines more for non-stop flights, which is why those flights can be more expensive than a flight with a stopover over a longer distance. When you throw in the headache of dealing with an AWOL passenger, including delays, it’s little wonder airlines don’t like this hack.

It appears Lufthansa may be making an example out of a passenger to dissuade others. The Independent noted it’s been pretty much unheard of for passengers to be challenged or made to pay the difference.

But airlines do have terms in their conditions of carriage that warn passengers off the hidden city hack.

Qatar Airways, for example, has this in its fine print: “Should you change your transportation without our agreement or fail to fly the complete itinerary booked, we will assess the correct price for your actual travel.

“You will have to pay any difference between the price paid and the total price applicable, together with any applicable administration charge, for your revised transportation.”

Most airlines have a similar disclaimer in similar language.

What are the other risks for passengers?

Hidden city hacking has become such a reliable way to save money on flights, websites like Skiplagged have popped up to help passengers compare their options. (United Airlines took Skiplagged to court in 2015 but couldn’t get the site shut down.)

Firstly, passengers need to be confident when they end their journey in the stopover city, they will be able to collect their luggage at the airport.

Checked baggage is often tagged to the final destination, which means even if you’re ending the journey, your bags may not be. Veteran hackers often travel with only carry-on bags to avoid that problem.

Passengers also need to know that if they’re a no-show, the airline will cancel any other flights on their booking.

Another mistake novice hackers make is skipping the first leg of the journey, as opposed to the last. The whole journey will be canceled if you don’t show up for the first flight.

And there’s no point trying it with budget airlines, as they price their flights on a segment-by-segment basis, according to The Independent.

Click for more from News.com.au