Correctly handling redirects that contain cookies