Added option allow_redirections: :safe to open-uri in order to follow redirection