how to detect redirect chain