Move redirect detection to dispatch event