Headache

Plant extracts, including willow bark and spiraea, of which salicylic acid was the active ingredient, had been known to help alleviate headaches, pains and fevers since antiquity. The father of modern medicine, Hippocrates, who lived sometime between 460 BC and 377 BC, left historical records describing the use of powder made from the bark and leaves of the willow tree to help these symptoms.

Salicylic acid (Source: Wikipedia)

While salicylic acid was somewhat effective, it also caused digestive problems such as gastric irritation, bleeding, diarrhea, and even death when consumed in high doses.

In 1897, chemists working at Bayer AG produced a synthetically altered version of salicylic acid, called aspirin.

Aspirin (Aspirin: Wikipedia)
You can compare both agents by clicking on the 2D structures. Do you see the differences?

Aspirin binds to the enzyme COX-2 preventing the prostaglandin production and hence alleviates pain, e.g. a headache. However, COX-2 has a very similar near relative, the enzyme COX-1. COX-1 regulates the production of gastric mucosa. Since prostaglandins normally also have a protective role in the gastrointestinal tract, the most frequent adverse effect of aspirin is irritation of the gastric mucosa.