One way which might help you prevent a headache from being on the computer too long is setting up the screen correctly.
First, make sure your screen is perfectly centered on your desk. The screen should be directly across from your head, meaning if you are looking straight ahead, you see the midpoint of the screen. If you can picture a three dimensional axis in your head, this would mean centering it on the X axis. It is also important that your screen is tilt-centered on the Z axis. This means one edge of the screen should be no farther away from your eyes than the opposite edge. You can center it if you look at your screen from above. If you are reading something on your screen and it’s not centered in this way, your eyes will be strained from zooming in and out and focusing as you read each line of text. For the Y axis, or vertical, your screen should not be centered. It should be lower, and your eyes, when looking straight ahead, should look at the top of the screen, or somewhere near the top. Your eyes get less strained when looking slightly down than up.
Second, don’t set your screen brightness all the way up. Mine is actually at 44% on my main screen, and 50% on my secondary monitor. Full brightness is unnecessary unless you’re doing design work and just strains your eyes. You should find a nice balance between contrast and brightness so that it doesn’t seem too bright. This will be completely different for every monitor, so you have to find this balance on your own.
And finally, try to sit up straight in your chair. When you start sitting a bit sideways or with your head tilted, it makes the physical screen position adjustments useless.
Disclaimer: do not take these tips as medical facts. These may not work for you or might make your problem worse. These are just suggestions from someone who spends a lot of time on the computer. I am not responsible for anything resulting from the use of these suggestions.