My ophthalmologist said that the two things to do to prevent glasses headaches are to back off from the "correct" prescription slightly and to use computer glasses designed for focusing 2-3 feet away when at the computer rather than the distant target typical for corrective lenses.
Your optometry office can also test your glasses to make sure that they're actually the right prescription. Lensemakers sometimes (often?) do the fabrication slightly wrong.