Fix APIException handling in legacy URL redirection