Fixed badGateway handling
Working through race condition in HttpRelayingHandler