It may not work for you but I had years of chronic heartburn. While sick with covid in 2020, I stopped consuming coffee and alcohol. It took a few months and for the long covid symptoms to subside, and then no more heartburn. At all. I felt really dumb that I never connected it to coffee before. I didn’t experience direct symptoms from coffee and I didn’t consume an excess amount. But it definitely was the cause.
I'm a couple weeks into giving up coffee because of heartburn, and yeah, this tracks... unfortunately. I've replaced heartburn with heartache (having given up a beverage I've enjoyed daily for over 20 years).
I can confirm that eliminating coffee can make a big difference.
The kind of coffee you drink can make a huge difference as well. Filter coffee is typically larger in volume so there’s more acidic liquids going in to trigger your heartburn. Compared to espresso which is usually a smaller volume. It can be a huge difference in heartburn between coffee types.