An ulcer is an irritation and inflammation of the gastrointestinal tract, usually in the first part of the small intestine (duodenum) or the stomach. The nonsteroidal anti-inflammatory drugs taken for headache pain or prevention can cause or aggravate the condition. Some common nonsteroidal anti-inflammatory drugs are ibuprofen (Motrin®, Advil®, naproxen (Naprosyn®, Anaprox®, Aleve®), aspirin, ketoprofen (Orudis®), indomethacin (Indocin®), and celecoxib (Celebrex®).

Some medications taken for ulcers, such as cimetidine (Tagamet®) or ranitidine (Zantac®), have occasionally been used in the treatment of cluster headache.