When headache is a side effect of medicine, e.G., provigil, is it typically just a symptom to be treated, or a warning sign that the med is dangerous?

Symptom, if none bef. Mostlikely it is the side effect of the medication. If you stop the medication, the headache is gone; then most likely it is the side effect. However, if it persist after is stopped. Need to look for other causes.
Usually a SE. Headache is the most frequent side effect reported with Provigil and usually resolves in a couple of days to a week. If the headache is persistent and severe you should let your doc know.