# Configuring Conditions for HTTP Interfaces

## Contents
Overview Requires Endpoint Condition Requires Link Condition

## Overview
In certain cases, it may be desirable to pull down the HTTP Interface that accepts traffic for the Enterprise Gateway. For example, if the back-end Web Service is unavailable or if the physical interface on the machine loses connectivity to the network, it is possible to shut down the HTTP Interface so that it stops accepting requests. A typical scenario where this functionality proves useful is as follows: A load balancer sits in front of several running instances of the Enterprise Gateway and round-robins requests between them all. A client sends SSL requests through the load balancer, which forwards them opaquely to one of the Enterprise Gateway instances. The Enterprise Gateway terminates the SSL connection, processes the message with the configured policy, and forwards the request on to the back-end Web Service. In this deployment scenario, the load balancer does not want to keep sending requests to an instance of the Enterprise Gateway if it has either lost connectivity to the network or if the back-end Web Service is unavailable. If either of these conditions hold, the load balancer should stop attempting to route requests through this instance of the Enterprise Gateway and use the other instances instead. So then, how can the load balancer determine the availability of the Web Service and also the connectivity of the machine hosting the Enterprise Gateway to the network on which the Web Service resides? Given that the request from the client to the Enterprise Gateway is over SSL, the load balancer has no way of decrypting the encrypted SSL data to determine whether or not a SOAP Fault, for example, has been returned from the Enterprise Gateway to indicate a connection failure. The solution is to configure certain conditions for each HTTP Interface, which must hold in order for the HTTP Interface to remain available and accept requests. If any of the associated conditions fail, the Interface will be brought down and will not accept any more requests until the failed condition becomes true and the HTTP Interface is restarted. Once the load balancer receives a connection failure from the Enterprise Gateway (which it will when the HTTP Interface is down) it will stop sending requests to this Enterprise Gateway and will choose to round-robin requests amongst the other instances instead. The following conditions can be configured on the HTTP Interface: Requires Endpoint: The HTTP Interface will remain up only if the Remote Host is available. The Remote Host is polled periodically to determine availability so that the HTTP Interface can be brought back up automatically when the Remote Host becomes available again. Requires Link: The HTTP Interface will remain up only if a named physical interface has connectivity to the network. As soon as a "down" physical interface regains connectivity, the HTTP Interface will automatically come back up again. Conditions can be configured for an HTTP Interface by right clicking on the HTTP Interface (e.g. "*:8080") node under the Process node in the tree view of the Policy Studio. Select the Add Condition menu option and then either the Requires Endpoint or Requires Link option depending on your requirements. The sections below describe how to configure these conditions.
## Requires Endpoint Condition
A Requires Endpoint Condition can be configured in cases where you only want to keep the HTTP Interface up if the back end Web Service (i.e. the Remote Host) is available. An HTTP Watchdog can be configured for the Remote Host, which is then responsible for polling the Remote Host periodically to ensure that the Web Service is available. Take a look at the Remote Hosts and Configuring HTTP Watchdogs help pages for more information. Remote Host: The HTTP Interface will be shut down if the Remote Host selected here is deemed to be unavailable. The Remote Host can be continuously polled so that the Interface can be brought up again when the Remote Host becomes available again.
## Requires Link Condition
The Requires Link Condition is used to bring down the HTTP Interface if a named physical network interface is no longer connected to the network. For example, if the cable is removed from the ethernet switch, the dependent HTTP Interface will be brought down immediately. The HTTP Interface will only start listening again once the physical interface is connected to the network again (i.e. when the ethernet cable is plugged back in). Important Note: The Requires Link Condition is only available on Linux and Solaris platforms. Interface Name: The HTTP Interface will be brought down if the physical network interface named here is no longer connected to the network. On Unix platforms, physical network interfaces are usually named "eth0", "eth1", and so on. On Solaris machines, interfaces are named according to the vendor of the network card, for example, "bge0", "bge1", etc.