For a while there I was getting extreme "exertion headaches" to the point of nausea and extreme light sensitivity. Once all these effects kept persisting for longer periods of time I started trying to change certain variables. Actually, that and the first night I had to drive home with sunglasses on because I felt everyone had their brights on and I couldn't stand it. At 9PM. In January. lol
For me it was a few things, but I feel primarily a matter of changing my breathing patterns and holding my breath for more reps, particularly on my last sets of squats when I was doing amrap. If I took a huge breath and exhaled at the top before repeating on every rep I could literally feel the headache starting to creep in on the sixth rep, I would just keep going, by the time it was at fifteen it was throbbing, I basically would only stop upwards of twenty due to feeling like I was going to have a brain hemorrhage or something rather than not having the drive in my body. Once I started holding for the first five reps, the second five, then slowly going maybe 3 more, 2 more, then a few breaths for each rep for the final few really helped improve things. I could notice this immediately.
I should mention the other discovery after enough of these episodes was that dumping really cold water on the back of my skull to the point of getting a headache from that was the only thing that would help. Like full stream out of a garden hose, cold shower wasn't as highly directed in that single spot.
I think it has a lot to do with blood flow and pressure building and releasing in certain patterns as well as your internal temperature in sensitive areas such as your brain. You mention the intensity not mattering so much as the sweat, so this is why I mention my experience. I'm sure they are all different to a certain degree.