Thank you for the query.
You havent mentioned what kind of cancer have you had so it is hard to tell about possible recurring of it.
If you do use plenty of painkillers (mostly non-steroidal anti-inflammatory drugs) the reason of your stomach pain is most likely peptic ulcer
. I understand that you use such medicines for your headaches
however it is necessary to protect your stomach with proton pump
inhibitors in case of long term painkillers usage.
I suggest you to visit your doctor and get scheduled for upper GI endoscopy
. In a meanwhile you should avoid coffee, chocolate, fatty foods, alcohol.
Hope this will help.