make a more general check out of this

The real reason is that jenkins is responding with an invalid Location
URL for the 302 redirect response. We can work around this by not
following the invalid redirect and instead just check if the redirect is
to an error page.