Improved handling of redirect responses