You have a headache because your body is overloaded, especially your heart, and your breathing is accelerated, mainly oxygen.
Second, exercise and sweating make you lose water, and your body lacks electrolytes to maintain water, so the pituitary gland has to try to balance this balance. Naturally, I feel uncomfortable in my head.
But it's not a big problem, it just means that you are weak. Stick to it for a while and it won't happen again. You will feel very fresh and comfortable.
Life lies in exercise. I hope you can take part in outdoor sports more, which is good for your health. You should know that health is the capital of revolution, and exercise can also reduce your stress and improve your work efficiency.