some more clean redirection detection and handling
updated json sample