The traffic manager home page is the main control panel for your cluster. It displays an overview of your current set-up and status and allows you to start and stop all your services.

Overview

1. Status Applet

This gives a snapshot of your traffic.

2. Section Buttons

These take you to each admin section.

3. Wizards and Search

The Wizards are designed to walk you through common actions. The 'Manage a new service' wizard is particularly useful.

The Search box allows you to quickly locate and navigate to configuration items of interest. Matching results will appear in a pop-up as you type.

4. Logout Button

This lets you logout after an admin session or to change which user you are logged in as. You will eventually be logged out automatically when the admin server times-out (after a period of inactivity). The timeout can be controlled by changing the Login Timeout setting.

5. Login Information Banner

This banner describes the previous successful login attempt by the current user on this system. Any previous failed attempts are also shown here.

6. Traffic Managers

These are your traffic managers. Any errors with a traffic manager will appear beside it.

7. Virtual Servers

These are your virtual servers.

8. Start/Stop Buttons

These start and stop your services. They also display whether the service is running or not.

9. Pools

These are the pools used by each service. They are color co-ordinated by their state of health. Green is healthy and running, orange has problems but is still running, red has an error and is not running, grey has been stopped by you.

10. Log

Errors, warnings and useful messages from your traffic managers appear here along with whichever traffic manager issued the message.

Status Applet

The top part of the status applet shows the current health of your cluster (the color of the light and the status message). The bottom part graphs the traffic flowing through it; the bar graph shows the traffic written by each virtual server and the total bytes written is displayed next to it. Traffic figures are smoothed slightly.

The status applet gives an immediate guide to how your cluster is performing which is especially useful after you make a configuration change.

1. Cluster Status Light

This tells you quickly if your cluster is OK. Green is 'OK', Orange is 'Warning' and Red is 'Error'. When a configuration change is synchronizing across your traffic managers this light will flash green. If you have an error, clicking on the light will take you to the diagnose page.

If the status changes, and you are viewing the Home Page, the applet will reload the Home Page to update the display.

2. Message

This is a brief status message. Normally it will say 'Cluster OK', however any errors that occur will be displayed here.

3. Pause/Play Button

This button will pause the applet - reducing the load on your browser, local machine and the admin server. This is especially useful if you are viewing more than one admin page at a time. To restart a paused applet, press the same button again, which will look like a play button.

4. Tear-off button

This button (which resembles an eject button) allows you to launch the applet in a mini-window so you can monitor your cluster in a corner of your screen while working on another task.

5. Traffic Meters

These meters graph traffic as it passes through your virtual servers. You will have one bar for each running virtual server, and if you move your mouse over them a tooltip will appear showing which virtual server and port it is reporting and how much traffic is passing through it at the moment (smoothed over a short period).

The bars are plotted when a packet passes through, and fade away once the traffic ceases. They don't give a comparative view of the traffic through several virtual servers - use the Current Activity page for this kind of analysis.

6. Total Bandwidth

This provides an indication of how much traffic is currently passing through your traffic managers. It is smoothed over the last few seconds.

Status, Error and Warning Icons

These icons appear next to each virtual server, and in the event log. A description of each follows:

  Indicates running OK

This service is operating correctly and has no problems. For an event log entry, this means that the entry does not signify a problem.

  Indicates a warning

This service has a problem that isn't serious enough to prevent it from operating, but is prevented from running to its full ability.

Next to an event log entry, this indicates a 'warning' condition, but not a critical error.

  Indicates a serious error

This service has a serious problem and cannot operate.

Next to an event log entry, this indicates a serious or critical error.

The home page should refresh automatically if an error occurs so it is ok to leave it open to catch problems as they occur.

Traffic Managers Section

The status of each of the traffic managers in your cluster is displayed here.

Errors

If there is a problem with any of your traffic mangers, a warning triangle (see Status, Error and Warning Icons) will be displayed along with it. Clicking on the Diagnose button will provide a full explanation of what the error is.

Services Section

This shows the services that your cluster is configured for, what pools they use, whether they are running and any errors or warnings that pertain to them.

Virtual Server Column

This provides a summary of the service with protocol and port number.

Start/Stop Buttons

These work as you might expect: they start and stop the service.

The other states are:

Flashing Green

A flashing green start button indicates that the service is starting up (i.e. all the traffic managers are being instructed to pass traffic onto the virtual server). It should stop flashing once all the traffic managers have received a start signal. This might occur if, for instance, some of your traffic managers are located separated by a slow connection to the others (e.g. on the other side of the world).

Note: Your virtual server starts accepting traffic the moment the first traffic manager receives the start signal — not the last. If the green button is flashing then your service is almost certainly up-and-running.

Flashing Amber

A flashing amber start button indicates that the service has a non-fatal problem and is still running. An error or warning triangle will indicate where in the virtual server configuration the problem has occurred.

Status Icon Column

This icon shows the error status of the virtual server (see Status, Error and Warning Icons). Clicking on this icon will take you through to the Diagnose page — especially useful if there is an error.

Pools Column

This gives a visual summary of the pools that the service uses and the status of the nodes used by the pool. Any problems with a pool or node should appear in more detail on the Diagnose page. The pools are ordered by how they are considered for use (i.e. in the order they appear in the rules that the virtual server uses) — therefore the default pool should always be listed last.

The icons show the following states:

Indicates not in use:

This pool is not in use, because the virtual server is stopped.

Indicates running ok:

The pool is running and has no problems.

Indicates a problem:

One or more of the nodes in the pool have a problem. The remaining nodes are still running.

Indicates a serious error:

The pool has a serious problem; all of its nodes have failed.

More detail can be gained from each of these icons by placing your mouse over them over them. Click the Diagnose button for a detailed report.

Sort by…

This tool allows you to sort the virtual server list by name and port in ascending and descending order. It only appears if you have more than four virtual servers.

Event Log

This is a quick summary of the event log:

Anything serious listed in the log should appear in more detail on the Diagnose page. If you want to tail the logs that generate this, you will find them at ZEUSHOME/zxtm/log/errors on your Stingray machines.


A traffic IP group is a set of IP addresses that will be distributed across a number of traffic managers. If a traffic manager fails, any IP addresses in the traffic IP group that were assigned to it will be redistributed across the remaining traffic managers. This provides fault tolerance.

Stingray must run as root for front-end fault-tolerance to work.

Traffic IP Groups on EC2 are implemented using Amazon's Elastic IP addresses. An Elastic IP Address is a public IP address which can be reserved and assigned manually to a EC2 instance. If instance is running inside EC2-Classic then it will replace the randomly-assigned default public IP address that the instance was allocated when it was created.

The Elastic IP addresses you use with instances in EC2-Classic are not available to use inside your EC2-VPC. You must allocate a separate set of addresses to use in your VPC

If the instance is running in EC2-Classic, then Amazon places some restrictions on Elastic IP Addresses, which are reflected in the behaviour and capabilities of Traffic IP Groups on EC2. In particular, an instance can only have one public IP (default or Elastic) assigned to it at a time, and all traffic to an Elastic IP Address is delivered to the same instance.

To provide fault tolerance for an Elastic IP address, you can create a Traffic IP Group that manages this EIP, ensuring that it is always associated with a working traffic manager. For instances running inside your VPC, traffic manager associates this EIP with Secondary Private IP address (with no existing EIP association) of the default network interface.

Traffic IP Group

This section shows the current traffic IP groups. It shows which machine is currently hosting each IP address in the traffic IP group. If an IP address is not hosted by any machine, or is hosted by more than one machine, an error will be flagged. Use the Diagnose page to view more detailed error descriptions.

Traffic IP Networks

This section lists your network interface mappings. These are used for raising traffic IP addresses on specific interfaces on your system. Click on Network Settings, or the Edit link, to add new mappings.

Create a New Traffic IP Group

To create a new Traffic IP group you must supply a unique name for the group, the list of traffic managers across which the IP addresses should be distributed and the IP addresses to manage. The IP addresses should be specified as a space or comma separated list, e.g. 10.100.1.2, 10.100.3.4, 2001:db8:12:a3:b2::5.

Note that the server must already have addresses of the same IP version in the same subnet on one of its network cards. Stingray will then raise each traffic IP address on a matching card.

Once a new traffic IP group is created, it may take a few seconds for the IP addresses to become available.

It is good practice always to check if another machine on your network is using an IP before you assign it to an IP group. Whatever you do — don't give one of your traffic managers' real IPs in here as this will cause the machine to reject all network traffic. This can be quite tricky to recover from.

IP Mode

Raise each address on a single machine (Single-Hosted mode)

In this mode IP addresses are distributed between all the traffic managers specified. Each IP address is raised only on a single machine, and when a machine fails its IP addresses are moved to the other machines in the group.

Raise each address on every machine in the group (Multi-Hosted mode)

This mode allows an IP address to be raised on more than one traffic manager at the same time. Connections are handled evenly by the active traffic managers in the group.

This mode requires the IP sharing kernel module (Linux only) and support by your network hardware , see the User Manual for more information .

The multicast IP address is used to distribute the load across the machines in the group. Specify one that does not clash with any other multicast groups running on your network.

To create a new traffic IP group you must supply a unique name for the group, the list of traffic managers across which the IP address should be shared, and the Elastic IP(s) to manage.

Difference between Traffic IP Groups which manages EC2-VPC Elastic IP(s) and EC2-Classic Elastic IP
EC2-VPC GroupEC2-Classic Group
Traffic IP group can contain multiple Elastic IPs Traffic IP group can contain only one Elastic IP
A traffic manager running inside VPC can be part of multiple traffic IP groups A traffic manager running in EC2-Classic can only be part of one traffic IP group
Each Elastic IP association will need a secondary private IP which has no existing associations and is not listed in any virtual server's "Listening on" addresses Not applicable

To create a new group there must be an Elastic IP available that is not associated with any other instances. A new Elastic IPs can be allocated in the 'Manage Elastic IPs' section below.

If traffic managers in the Traffic IP Groups are running inside VPC then they should have Secondary Private IP Address (with no existing Elastic IP association) for each Elastic IP in the group which a traffic manager is part of, assigned to their default network interface for successful allocation of Elastic IP Address. New Secondary Private IP addresses can be assigned on Networking Page of each traffic manager.

After creating a valid Traffic IP group, each Elastic IP address will be allocated to one of the members of the group. It usually takes EC2 a few seconds to do this.

If you are connected to the administration interface of the machine that is assigned the Elastic IP and is running in EC2-Classic, you will be redirected to a new administration URL. You might get a certificate warning from your browser, this is normal and can be ignored.

Manage Elastic IPs

This section allows you to allocate and release Elastic IPs associated with your account, and view information on the EIPs you currently have.

Following information is displayed
NameDescription
Instance ID Instance ID associated with the Elastic IP
Domain Type of the Elastic IP. standard represents an Elastic IP address that can only be used in EC2-Classic. vpc represents an Elastic IP address that can only be used in EC2-VPC.
Network Interface ID Network Interface ID associated with the Elastic IP. VPC Only
Private IP The primary or secondary private IP address associated with the Elastic IP address. VPC Only.
Traffic Manager Traffic Manager Name
Traffic IP Group Traffic IP Group Name

Inside VPC, the Elastic IP address which is associated with Primary Private IP address of the instance can't be deleted as the traffic manager assumes that it's being used as management IP.

Amazon charges for unused Elastic IPs (those not associated with an instance). Associating an EIP is also charged, though currently the first 100 associations are free. Bandwidth charges for Elastic IPs are the same as default public IP addresses. Please see Amazon's documentation for up to date pricing information.

This page shows the traffic IPs and traffic managers in the group.

Current Traffic IPs and Traffic Managers

This shows the traffic IP addresses in the group, and the set of traffic managers they span. The traffic IP addresses will automatically be redistributed in the event of a traffic manager failure.

To delete a traffic IP address or traffic manager from the traffic IP group, select it with the checkbox and click Update.

IP Distribution Mode - Single hosted

In this mode IP addresses are distributed between all the traffic managers specified. Each IP address is only raised on a single machine, and when a machine fails its IP addresses are moved to the other machines in the group.

IP Distribution Mode - Multi hosted

This mode allows an IP address to be raised on more than one traffic manager at the same time. Connections are handled evenly by the active traffic managers in the group.

This mode requires the IP sharing kernel module (Linux only) and support by your network hardware. See the User Manual for more information.

Related settings

The multicast IP address is used to distribute the load across the machines in the group. Specify one that does not clash with any other multicast groups running on your network.

The consider client source port setting makes the traffic managers in the group use the source IP and source port to determine which traffic manager handles the connection (usually it's just the source IP address). This can make connection distribution between traffic managers more even if you only get connections from a few source IPs. Caution is advised when using this setting in conjunction with Session Persistence classes. Some persistence classes, for example, share state information between all traffic managers in the cluster, so there is a danger that connections might be distributed before the state has been successfully replicated. See the Session Persistence section for more information on the types of persistence that might encounter problems when used with this setting.
Virtual Servers that manage FTP, SIP, and RTSP traffic cannot use Traffic IP Groups with this setting enabled. Requests from the same client must be sent to the same traffic manager for these protocols to work.

Hardware compatibility

This feature requires support by the network hardware connected to your Stingray traffic managers. Certain types of network hardware may need some special multicast MAC based configuration prior to enabling Multi-Hosted IPs, otherwise traffic may be dropped.
An example of such configuration with Cisco switches is given below:

Cisco Catalyst switches

Cisco Catalyst switches using the IOS software, need to be manually told about each Multi-Hosted IP's multicast MAC address, which is used to deliver the IP's incoming connections to all machines in the Traffic IP group. This can be done by logging into the CLI of the switch and using the following commands:

For each Multi-Hosted IP in the Traffic IP group:
arp <Multi-Hosted IP> <MAC>

Then, for Cisco Catalyst 6000/6500 series switches:
mac-address-table static <MAC> interface <Interfaces> disable-snooping

Or for all other Catalyst switches:
mac-address-table static <MAC> interface <Interfaces>

Replace <MAC> with the MAC address listed on the Edit Traffic IP Groups page, and <Interfaces> with the interfaces on the switch connected to the Stingray cluster. Refer to Cisco's documentation for details.

Add Traffic IPs or Traffic Managers

To add a traffic manager to the group, select it and click Update.

To add new traffic IP addresses, enter a space-separated or comma-separated list of IP addresses and click Update. It may take a few seconds for the new traffic IP addresses to be redistributed across the group.

It is good practice always to check if another machine on your network is using an IP before you assign it to an IP group. Whatever you do — don't give one of your traffic managers' real IPs in here as this will cause the machine to reject all network traffic. This can be quite tricky to recover from.

This page shows the Traffic IP group's Elastic IP and the traffic managers in the group.

The Current Elastic IP and Traffic Managers

This section shows the Elastic IP associated with the Traffic IP group and the traffic manager to which it is currently assigned. EIP(s) in the group can be modified using given list of EIPs. To change the EIP you must have at least one that is not assigned to a traffic IP group.

To remove a traffic manager from the Traffic IP group, select it with the checkbox and click Update.

Add Traffic IPs or Traffic Managers

To add a traffic manager to the group, select it and click Update. This section only lists traffic managers that are not members of other traffic IP groups.

Delete a Traffic IP Group

To delete a traffic IP group, select the Confirm checkbox and click Delete Traffic IP Group. When a traffic IP group is deleted, the associated traffic IP addresses will no longer be available for receiving traffic, so you should ensure that by deleting the traffic IP group external connectivity is not compromised.

Deleting a traffic IP group will cause its Elastic IP to be disassociated from all machines. If the traffic manager that had the Elastic IP is running in EC2-Classic then it will be given a new public address, which can take several minutes. During this transition phase the machine will have no external connectivity. If you were connected to that machine's interface, you will need to use an EC2 management tool to find the instance's new public IP and connect to it.

Stingray Traffic Manager needs to identify a suitable hardware interface on which to raise a Traffic IP. This page provides a way to configure the interfaces on which Traffic IP addresses, for a given subnet, are raised.

Add Network

This will only accept a subnet in a valid CIDR format, specifying the network and the subnet mask.

For example: 1.2.3.0/24 or 1.2.0.0/255.255.0.0

Default Interface

This is a list of hardware interfaces that are common to all machines in the cluster. Choose a value from this list to map a specific network to an interface on all machines. You can also choose 'None' and later edit network mappings that are specific to machines in the cluster.

While raising an IP, the mapping with the most specific network prefix is chosen to select an interface. Mappings appear in order in which they will be chosen for a given Traffic IP.

This page shows a list of all of your virtual servers, and allows you to create new ones. You can view a brief configuration summary for each virtual server by unfolding its display. A virtual server's settings can be edited by clicking on the name or Edit link associated with each one.

Virtual Servers and Services

A service is a network protocol active on a port.

A virtual server provides a service by utilizing server nodes in its pool.

What protocol?

You should select the most appropriate protocol that represents the type of traffic that the service will be handling. If you are using a TCP-based request-response protocol that isn't on the list, then pick either the 'Generic server first' or 'Generic client first' option, depending on whether the client sends a request first or the server sends a message to the client. If you are using a protocol that does not require the server to respond to every message that the client sends, or if you need extra flexibility when processing data in TrafficScript, you can choose the 'Generic streaming' option. This server type allows either the client or server to send the first message when a connection is established and also allows TrafficScript rules to be invoked whenever data is received on the connection. If in doubt, contact your support provider to ensure that Stingray supports the protocol you want to use.

The 'SSL' protocols should be used only for SSL traffic that is not encrypted or decrypted by Stingray. For example, if you are load balancing an SSL-encrypted website, and you want Stingray to decrypt the traffic, then pick 'HTTP' as the protocol and then set up the SSL decrypt options on the virtual server edit pages.

Which port?

The admin server will try to help pick the standard port for the protocol you choose, but you can run any protocol on any port, as long as only one service is listening on each port.

Creating a new Virtual Server

To add a new virtual server, choose an appropriate name, protocol, port and pool. Then hit Create Virtual Server

A virtual server name cannot contain reserved characters such as '!', '.', '/' or '\'. We recommend short descriptive names like Extranet Gateway.

This page displays the configuration for a virtual server and allows you to edit its basic settings.

At the top of the page is some basic information on this virtual server, including which pools it is using. Pools can be used by the pool.use() command in a TrafficScript rule, and each virtual server has a default pool that is used if a pool is not selected by a TrafficScript rule. Clicking on the pool icon will take you through to that pool's editing page.

Basic Settings

This section allows you to rename your virtual server and change its basic properties.

A virtual server name should be a short description e.g. Extranet Gateway. It cannot contain reserved characters like '!', '.', '/' or '\'.
Internal Protocol

This is the protocol your clients and back-ends use. Setting it correctly will allow protocol-specific features, such as rules that edit this protocol's headers, to work properly.

If you are not using one of the standard protocols on the list, there are other options:

Generic server first

This is for protocols where the server writes data (such as a welcome message) first.

Generic client first

This is for protocols where the client writes data first, e.g. to identify itself before the server will respond.

Generic streaming

This is for protocols where there is no request-response semantic. Either side of the connection can write the first message.

Listening On

This setting allows you to define which IP addresses this virtual server will get its traffic from.

All IP addresses

The virtual server will take all the traffic on its port for all the IPs that the traffic managers listen on. You can only have one virtual server per cluster listening on each port.

Traffic IP Groups...

The virtual server will take all the traffic on its port for all traffic IP groups selected. This allows you to have multiple virtual servers listening on the same port but on different IP groups.

Domain names and IP addresses...

The virtual server will take all the traffic on its port for all domain names and IPs listed. The domain names and IPs must correspond to local addresses. This allows you to have multiple virtual servers listening on the same port but on different IPs, e.g. one server could take all web traffic for www.zeus.com while another could process traffic for www.zeus.net.

When the traffic manager is running in EC2-VPC, you can also specify Elastic IPs or their corresponding DNS names. The Virtual Server will listen on the corresponding private IP.

Application Firewall

If you have installed the Stingray Application Firewall then you can secure this virtual server by setting Application Firewall to 'Enabled'. This option is only available for virtual servers managing HTTP traffic.

When the firewall is enabled, a TrafficScript rule called Stingray Application Firewall Enforcer is added to the virtual server. This rule sends all requests and responses to Stingray Application Firewall, which decides how they should be handled. The rule will then allow the request or response through, modify it, or send an appropriate error response accordingly.

Note that you cannot delete the Stingray Application Firewall Enforcer rule, but you can alter at which point in the order of execution of your TrafficScript rules it is run. This allows you to, for example, add a rule that runs before the Enforcer that whitelists certain requests. The Enforcer will then allow these requests straight through without sending them to Stingray Application Firewall.

If the virtual server listens on IPv6 addresses, either by specific configuration or by listening on "All IP addresses", traffic received on those addresses will not use IP transparency.
It may take a few moments for these changes to filter through to each traffic manager, especially if you have a large cluster split across more than one physical location.

Settings Categories

Virtual server settings are split into categories to make them easier to navigate. Each of the folding sections provides a quick summary of the configuration for that category and leads through to a more detailed page where all of the category's settings can be edited.

GLB Services
Contains the settings for attaching GLB Services to your virtual server. GLB Services provide policies for modifying DNS traffic to provide Global Load Balancing capabilities. They can be configured on the Catalogs > GLB Services page.
Rules
Contains the settings for attaching rules to your virtual server. Opening the fold shows a simple diagram of traffic flow through the rules in your virtual server and out to the pools it uses.
SSL Decryption
Contains SSL decryption settings - which certificate to use etc. Some protocol types do not allow for SSL-encrypted traffic, so this section is not displayed for them.
Assigned Classes
Contains settings for service protection, bandwidth management and service level monitoring Classes.

Bandwidth management and Service level monitoring are not available on all configurations.

Content Caching
Contains settings that control how and when the content generated by your web servers might be cached, in order to speed up your services.
Aptimizer
Contains settings to provide web content acceleration for applications hosted by this virtual server.
Content Compression
Contains settings that control how the HTTP response to the browser might be compressed.
Connection Analytics
Provides the ability to save details about selected connections when they complete. These details can be inspected later on the Activity > Connections page. Detailed timelines for connections and requests can also be obtained to aid in debug traffic handled by this virtual server.
Request Logging
Contains settings for recording usage statistics at a virtual server level.
Connection Management
Contains settings that control how the virtual server manages connections to the remote client - Timeouts, Keepalives, Memory limits etc.

GLB services associated with a virtual server will be used modify DNS responses. A records that have matching GLB Services will be processed by them. Where there is more than one matching GLB Service the most specific match will be used

GLB services are stored centrally in the GLB Services Catalog, and each virtual server refers to the copy in the catalog. This way the same GLB service may be used by several virtual servers at the same time.

Add new GLB Service

In this section you can attach a new GLB service to your virtual server from the catalog.


TrafficScript rules applied to a virtual server are executed by it each time a new request is received.

Rules are stored centrally in the Rules Catalog, and each virtual server refers to the copy in the catalog. This way the same rule may be used by several virtual servers at the same time.

Request Rules are applied to the incoming request before it is sent to a Pool.

Response rules are applied to the response before it is returned to the client.

Transaction completion rules are applied at the end of the transaction, for example when the client or server closes the connection or when the connection times out. In the case of HTTP, RTSP and SIP virtual servers, transactions are also considered complete when a full response has been sent to the client, even if the connection is kept alive to handle another request.

Rules List

This is the list of rules attached to your virtual server. If your rules catalog is empty, you can't do much here. To add a rule click the manage Rules in Catalog link.

Add New Rule

In this section you can attach a new request or response rule to your virtual server from the catalog.


The SSL Decryption page displays the SSL settings that are used by the virtual server.

SSL Decryption

These settings control how incoming SSL connections are decrypted.

ssl_decrypt
Whether or not this virtual server will decrypt incoming SSL traffic.
certificate
This is the name of the certificate used to authenticate the service, and decrypt traffic. The certificate is stored in the SSL Server Certificates Catalog.
ssl_sites
This setting allows you to link different IP addresses and hostnames (where the browser supports TLS Server Name Indication) to particular SSL certificates. If two different services are hosted on the same virtual server but are accessed by different domain names then this setting will allow you to provide a different certificate for each service.
Hostnames can include wildcards to match multiple names. The most specific hostname will be matched first, followed by a wildcarded hostname and finally an IP address. If no match is found then the default certificate will be used.
ssl_headers
Stingray can append extra information to the SSL-decoded HTTP request for web applications, to allow them to check the SSL details. This includes information on the SSL certificate used, the SSL session ID, and the ciphers used in the connection. The following headers are added:
Header nameSample Value
SSLClientCipher SSL_RSA_WITH_RC4_128_SHA, version=SSLv3, bits=128
SSLClientCertStatus NoClientCert or OK
SSLSessionID 8723367551317ABE5443278C6E… (64 hex characters)
ssl_trust_magic
This option is only useful if you have a setup involving two levels of traffic managers, and the first cluster of traffic managers are sending traffic to the second level. Without this option, the SSL connections to the second-level traffic managers will all appear to originate from the first level. With this option enabled (and with the first-level traffic managers properly configured), the traffic managers can pass the true origin IP addresses to each other.
ssl_send_close_alerts
It is common for SSL servers to omit the final close alert when shutting down an SSL connection. However, some clients, especially FTP clients, are strict when it comes to handling close alerts and will fail to function properly if the alerts are omitted. Close alerts are disabled by default because they can break some older SSL implementations, including versions of Microsoft Internet Explorer. You can also modify this behavior on the fly using TrafficScript rules.
ssl_prefer_sslv3
This option controls whether or not to prefer SSLv3 over TLS when the client appears to support both in the initial hello packet. SSLv3 is slightly faster, but a few clients don't allow SSLv3 replies, but still send the ClientHello inside SSLv2 or SSLv3 records. The default option is to prefer SSLv3 over TLS for speed.
ssl_ocsp_stapling
This option controls processing of the TLS Certificate Status Request Extension, as described in RFC 6066 (commonly known as OCSP stapling). If enabled, the traffic manager will include an OCSP response in handshakes with clients that include this extension, if one is available. The locations of the OCSP responders will be retrieved from the Authority Information Access extensions in the server certificates for this vserver. Therefore for this feature to function correctly, the traffic manager must be able to make outgoing connections to these OCSP responders.
ssl!support_ssl2
ssl!support_ssl3
ssl!support_tls1
ssl!support_tls1.1
These flags can be used to override the global setting for the given SSL/TLS version for this Virtual Server. Use to enable or disable support for specific SSL/TLS versions for incoming SSL traffic on this Virtual Server.
ssl!ssl_ciphers
This is a list (space, comma or colon separated) of cipher suites that will be allowed for incoming SSL traffic on this Virtual Server. The order of the supplied list determines the priority of the ciphers. A blank value means that the global default will be used.

Please refer to the global setting ssl!ssl3_ciphers for more details.

ftp!ssl_data (FTP only)
If enabled, ftp!ssl_data will cause the Virtual Server to decrypt all data connections using the same public certificate as is used for the control port. Note that the FTP Virtual Server must also be configured to decrypt SSL with ssl_decrypt.
If disabled, the Virtual Server will pass all data through unmodified. If the back-end server wishes to use SSL on the data connection, the client will negotiate directly with the back-end server, with Stingray as an intermediate proxy.
smtp!expect_starttls (SMTP only)
If enabled, smtp!expect_starttls will cause the Virtual Server to listen for unencrypted SMTP connections and then wait for the client to send a STARTTLS request once a connection has been established. A secure connection between Stingray and the client will then be negotiated to transfer the SMTP data.

SSL Client Authentication

These settings control how clients are authenticated in SSL transactions.

request_client_cert
Should this virtual server request an identifying certificate from each client? There are three options:
  • Do not request a client certificate
  • Request, but do not require, a client certificate
  • Require a client certificate

Please note that clients are not allowed to provide a certificate unless the server requests one.
client_cas
Which certificate authorities should be trusted by this virtual server to validate client certificates?
issued_certs_never_expire
Verifying a client certificate comprises the cryptographic check that the peer actually possesses the private key and that the certificate was signed by one of the CAs configured in 'client_cas'. It also involves more trivial checks like the start and end date of the certificate presented. In some cases, the certificate used by a client cannot be changed, for example a cert stored in the firmware of a mobile device. When such a cert expires, the client won't be able to authenticate itself any more. If the virtual server should nevertheless accept the SSL connection even if the client's certificate has expired, mark the certificate authorities for which this should be the case. This setting should be applied with caution because it effectively disables a check that must be made according to the SSL specification. All other checks are still made, including lookup of the certificate in the revocation lists (CLR). Note that the certificate verification is only relaxed for the combination of the certificate authorities selected and this virtual server. Certificates signed by other CAs will be checked as usual. Similarly, the check carried out by other virtual servers will not be affected.
ssl_client_cert_headers
Similarly to ssl_headers, the virtual server can add HTTP headers to each request to show the data in the client certificate:
Header nameSample Value
SSLClientCertVersion3
SSLClientCertSerialNumber742662
SSLClientCertIssuer C=US, ST=CA, L=San Jose, O=MyOrg
SSLClientCertSubject C=US, ST=CA, L=San Jose, O=MyOrg
SSLClientCertNotValidBefore 1155304575 (unixtime)
SSLClientCertNotValidAfter 1186840575 (unixtime)
SSLClientCertSubjectPublicKey RSA (2048 bit)
SSLClientCertSignatureAlgorithm md5withRSAEncryption
SSLClientCertHash 873FECCB50E0C1D34711ABE65BA70BA7
SSLClientCertSHA1Fingerprint 7D90A8EB6081183C0560970A7DA77306C40E5DD2
SSLClientCert (if enabled) The entire PEM-encoded certificate text.

SSL Client Certificate OCSP Checking

OCSP is a protocol used to check whether or not a client's certificate has been revoked. When a client tries to establish an SSL connection, the traffic manager connects over HTTP or HTTPS to an OCSP responder and requests revocation information about the client's certificate. If the certificate is reported as unknown or as having been revoked, the traffic manager will reject the certificate and close the connection to the client.

ssl_use_ocsp
If set to 'Yes', this virtual server will use OCSP to verify that client certificates have not been revoked.
ssl_ocsp_timeout
When contacting an OCSP responder, the traffic manager will wait for a response for the amount of time specified by this setting. If the OCSP responder has not replied within this time limit then the client's certificate will be rejected.
ssl_ocsp_max_response_age
If an OCSP response's 'thisUpdate' field is older than the number of seconds specified by this setting then the response will be considered invalid. If set to 0, the 'nextUpdate' field of the response will be used to determine whether it has expired or not.

Responses are cached for as long as they are considered valid, so altering this setting will affect the amount of time for which responses are cached.

If the time specified in the 'nextUpdate' field of the response has passed, the response is considered invalid regardless of this setting.

ssl_ocsp_time_tolerance
If the OCSP responder and traffic manager's clocks differ slightly then the times specified in the 'thisUpdate' and 'nextUpdate' fields of a response might cause the traffic manager to consider it invalid. If the responder's clock is a few seconds faster the traffic manager's clock, for example, then the 'thisUpdate' field of a response might appear to the traffic manager to be in the future.

The ssl_ocsp_time_tolerance setting allows you to specify how much tolerance to permit for clock differences.

Per issuer OCSP responder settings

The OCSP responders that the traffic manager uses to check client certificates can be configured on a per-issuer basis. Select a certificate authority in the Add Issuer Specific Settings section to add settings for that issuer. If the traffic manager receives a client certificate with an issuer that is not explicitly configured, the Default Settings will be used.
OCSP check
This setting determines whether an OCSP check will be performed for the issuer. If set to 'None', no OCSP check will be performed. If set to 'Optional', an OCSP check will be performed only if an OCSP URL can be determined for the client certificate. Selecting 'Always' will cause remote connections to be dropped if an appropriate OCSP responder URL cannot be determined.
Use AIA for URL
Issuers can embed an OCSP responder URL using the X.509 Authority Information Access extension into their client certificates. If this setting is enabled the traffic manager will use the extension, if it is available, otherwise it will use the fallback URL.
Fallback URL
If the responder URL cannot be determined by other means, this URL will be used.
Request signing certificate
OCSP requests can be signed so the responder can identify and authenticate the source of the request. You can select a certificate uploaded to the SSL Server Certificates catalog with which to sign the request, choose to use the default setting, or disable request signing.
Use nonce extension
A nonce is a unique sequence of data that can be added to OCSP requests. This sequence of data should be repeated in the corresponding response to ensure an attacker cannot re-send a 'good' OCSP response after a client certificate has been revoked.

If set to 'on' or 'strict', the traffic manager will add a nonce to its OCSP requests and will reject the client certificate if the response contains a nonce that does not match the one in the request. If set to 'strict', the traffic manager will also reject the client certificate if the response does not contain a nonce at all.

Not all OCSP responders support this extension. Responders sometimes return an 'unauthorized' response when they do not support nonces.
Using a nonce will also stop responders pre-generating responses to improve performance.

Responder certificate
OCSP responses are signed by the responder to prove they are genuine. You can select a specific certificate by which responses should be signed, or you can configure the system to expect the response to be signed by the issuer's certificate. In these cases, the certificate must be in the SSL Certificate Authorities catalog. You can also select "Signed by issuing certificate", which means the certificate must either be the issuer's certificate itself, or be signed by it and have the id-kp-OCSPSigning marker in its extendedKeyUsage extension, and have the id-pkix-ocsp-nocheck extension.

Service Protection

Service Protection classes are held and edited in a catalog and applied to a virtual server. The settings in a service protection class are applied to each connection immediately it is received by a virtual server.

Bandwidth Management

Bandwidth Management classes are held and edited in a catalog and applied to a virtual server. The settings in a bandwidth management class are applied to the response data for each connection. The bandwidth management class used by a connection can be changed using a TrafficScript rule.

Service Level Monitoring

Service Level Monitoring classes are held and edited in a catalog and applied to a virtual server. The settings in a service level monitoring class are used to assess the response time when a connection is made to a back-end node. Before a node is selected by a pool, the service level monitoring class used by a connection can be changed using a TrafficScript rule.

Bandwidth management and Service level monitoring are not available on all configurations.


Content Caching allows Stingray to store frequently accessed web pages. When another client requests the same page, Stingray can send the cached content directly, rather than forwarding the request onto a web server. Content Caching can dramatically speed up certain web sites, especially for dynamically generated pages.

Caching settings

These settings control how caching should be applied.

webcache!enabled

This controls whether or not content caching is enabled.

If Aptimizer is enabled then it will always store optimized resources, such as combined images, in the cache regardless of this setting.

Stingray will not attempt to cache optimized HTML pages generated by Aptimizer unless this setting is enabled.

If both the cache and Aptimizer are enabled then the traffic manager will also cache unoptimized resources that Aptimizer fetches.

webcache!time

How long Stingray will keep web content in its cache. After this time, Stingray will discard the cached data and will make new requests to the web servers to retrieve 'fresh' data.

webcache!errorpage_time

Error pages are also cached by Stingray (for example, '404 Not Found' pages). Caching error pages is helpful in many cases, however it is useful to set the cache time for errors to be shorter than that of ordinary pages, so that any site problems can be quickly fixed.

Server errors are never cached by Stingray.
webcache!control_out

The string to be used for the Cache-Control header in cached responses sent back to the client. This setting does not affect caching of Stingray itself, but should be obeyed by any cache sitting between Stingray and the client. To disable caching by other caches, for instance, use 'no-cache', to limit it to 1 minute, use 'max-age=60'

webcache!refresh_time

This setting controls the length of time, in seconds, prior to a resource expiring that Stingray will speculatively update the cache. With this feature, the cache can be refreshed before it expires, avoiding a large flood of requests to the back-end servers.

Refer to the Content Cache page for more information about content caching. Also, see the System>Global Settings page for settings that affect content caching for all virtual servers (e.g. total cache size).


Stingray Aptimizer automatically optimizes web page markup and elements so they load faster for end users.

Basic Settings

aptimizer!enabled

It is possible to fully enable or disable Aptimizer functionality for a virtual server using the aptimizer!enabled configuration key in the Basic Settings section.

Aptimizer Profiles

In this section, you can define the mappings between various acceleration Profiles you wish to use and the Scope within which they should apply. Both of these concepts are Catalog objects and must be created before being used on this page. Each of these concepts is explained in more detail in the Aptimizer Catalogs section.

You can define and map several Scopes to a single Profile, depending on your requirements, though a scope can only be used once within a single virtual server.


Content compression enables Stingray to compress web pages before delivering them to the client browser. This can decrease your site's bandwidth usage, and speed up the delivery of large web pages to clients with slow connections.

Some web servers also have the option to compress web pages, and it may be more efficient to spread the work of compressing pages across the web servers instead of using Stingray. However, it should not cause any problems if compression is enabled on both.

Compression settings

These settings control how compression should be applied.

gzip!enabled

This controls whether or not content compression is enabled.

gzip!compresslevel

This controls how much work Stingray will do to compress your web pages. A lower value will not compress data as well, but will use less CPU time. A higher value may compress data more, but may reduce Stingray's performance.

gzip!maxsize

The maximum size of document to compress. Often, larger files are already compressed (e.g. video streams, software) and so it would be wasteful to try compressing them again. If you have large files on your site that are aided by compression, you are advised to pre-compress them.

gzip!minsize

The minimum size of document to compress. Compressing small files provides little benefit.

gzip!nosize

Sometimes web servers will send files to a browser without reporting the file size. This is common with dynamically generated pages. Usually it is a benefit to compress these files, but if the files are enormous it can be quite CPU-intensive. This controls whether or not such files should be compressed.

What to compress

MIME types

Stingray will not compress absolutely everything that the web servers send out. For instance, there is little point attempting to compress images, as files like GIFs and JPEGs are already compressed.

Common MIME types to compress are 'text/plain' and 'text/html'. You may also use a wildcard to select several MIME types, e.g. 'text/*'.


The traffic manager has the ability to display a large amount of information about the timeline for a particular transaction. This can be a useful tool when tracing and debugging traffic handled by a virtual server.

The Activity > Connections page shows information about all the active connections currently being processed by the traffic manager and a selection of recently completed transactions.

This configuration section allows you to specify which completed transactions will appear on the Connections page, and what information about connections shown on the Connections page will be available.

Note that in the context of these settings, a transaction is defined as a completed communication between the client and the server. For all protocols, a transaction is considered complete when the connection is closed or has timed out. In the case of HTTP, SIP, and RTSP, a transaction is also considered complete when the server has sent a full response to the client.

Recent Connections

The Recent Connections settings allow you to select which transactions will have information about them temporarily saved after they have completed.

Saved transactions will appear after the currently active connections on the Connections page and will have a state of Complete or Closed.

A finite number of connections can be saved, as determined by the recent_conns setting configured on the System > Global Settings page. Only the most recent connections are saved here; the oldest connections will be removed to make room for new ones when the buffer is full. Note also that this buffer is shared between connections saved by all virtual servers hosted on the traffic manager.

There are two configuration settings that determine which connections will be saved upon completion:

recent_conns!enabled

If set to 'No', this virtual server will not save details about any connections it has processed. This setting cannot be overridden by any of the recentconns.* TrafficScript functions.

If set to 'Yes', this virtual server is permitted to save details about connections it has processed. Exactly which connections will have their details saved is determined by a combination of the recent_conns!save_all setting and the use of the recent_conns.include() and recent_conns.exclude() TrafficScript functions.

recent_conns!save_all

If set to 'Yes', the virtual server will save details of all connections it has processed to the Connections page by default. You can then use TrafficScript to identify specific transactions you want to exclude from the Connections page using the recentconns.exclude() function.

If set to 'No', the virtual server will not automatically save any transactions to the Connections page when they have completed. Instead, you must select which transactions you want to save using the TrafficScript function recentconns.include().

For example, you could choose to save information only about requests that generate a 404 response by setting recent_conns!save_all to 'No' and then adding a TrafficScript rule that calls the recentconns.include() function when the response code is 404.

Request Tracing

With request tracing enabled, the Activity > Connections page can be used to drill down into each individual request in detail. Request Tracing information is available to view both for active connections and for completed transactions that have been saved by the virtual server as a result of the recent_conns!* settings described previously.

The Request Tracing functionality has two cofiguration settings:

request_tracing!enabled

When enabled, the traffic manager will collect data on internal events. This data includes timing for when a request is received and when each rule is run, but it does not include information on individual reads and writes on sockets.

request_tracing!trace_io

When enabled, the traffic manager will collect data on individual read and write events while processing a connection. Note that enabling this setting could result in large numbers of events being logged for connections on which lots of data is being transferred.


Stingray can log requests on a virtual server level.

Requests can be logged to a file on disk, to a remote syslog daemon, or to both simultaneously. Each destination can have its own log format.

It is possible to select which requests are logged to the request log to aid with statistics gathering and application debugging.

The log!save_all setting determines whether all requests will be logged by default, or whether no requests will be logged by default. This behaviour can then be overridden on a per-request basis using the TrafficScript functions requestlog.include() and requestlog.exclude().

For example, to log only those requests for which it took more than 30 seconds to provide a full response to the client, you could set log!save_all to 'No'. You could then add a transaction completion rule that calls the requestlog.include() function if the stats.getTransactionDuration() function call indicates the request took longer than 30 seconds to complete.

Note that the log!save_all setting and the use of the requestlog.* TrafficScript functions apply both to requests logged to a file and to requests logged to a remote syslog. The same requests will be written to both destinations. If neither destination is enabled, the log!save_all setting and the requestlog.* TrafficScript functions have no effect.

Logging requests to file

Requests can be logged to a file on your system using the settings on this page. There are, however, a few issues to take into account when you have a cluster of traffic managers:

To add a request log to a virtual server, enter a filename, select a suitable format for the log lines, and switch log!enabled to 'Yes'.

Log file names and automatic log rotation

On a Stingray Appliance, log file naming and rotation is handled automatically according to the following rules:

  • The log files are checked hourly;
  • Any file that reaches 1GB in size is archived;
  • Once the cumulative size all current log files reach 6GB then the largest logs are archived in decreasing size order until the cumulative total goes below 6GB;
  • All remaining logs are archived daily.

Once the logs directory reaches 85% of capacity Stingray will start to delete the oldest files from the sub-directories that take up the most space.

Stingray can handle log rotation automatically. Use the %{Time-string}t option to put a timestamp in the filename, e.g. %zeushome%/zxtm/log/%v-%{%Y%m%d}t. If the filename changes, then Stingray will open a new log file.

If the log file is going to reside outside of ZEUSHOME, it is important to ensure that each machine in your cluster has a directory of that name and Stingray has permission to write to it.

Logging requests via syslog

Stingray can also send the request log information to a syslog daemon on a remote machine, according to the protocol described in RFC 3164. In this case, requests to all traffic managers in a cluster will go to the same destination. It has to be borne in mind, however, that the syslog protocol uses UDP and is therefore inherently unreliable.

To log requests via syslog, specify the hostname or IP address of the machine on which the syslog daemon is running, select a suitable log format, and switch syslog!enabled to 'Yes'.

By default, port 514 is used, but a non-standard port can be chosen by appending a colon and the port number to the host name or IP address. In the case of an IPv6 address, the square bracket notation defined in RFC 2732 has to be used, for instance [2001:8b0:3e6::2]:51415

The log message length limit defaults to 1024, which is the maximum set by RFC 3164. Messages exceeding the limit will get truncated before they are sent. The limit can be set to a value between 480 and 65535 bytes, according to the newer RFC 5426 (Transmission of Syslog Messages over UDP). Note that the receiving syslog must be able to handle messages of the configured limit. If the limit is larger than the layer 2 MTU on the path to the syslog, then devices on the path need to correctly perform IP fragmentation and reassembly.

Time String Macros

%{Time-string}t will insert the current time, expanded using the strftime() format detailed in the following table:

FormatMeaning FormatMeaning
%aMon Tue Wed ... %AMonday Tuesday ...
%bJan Feb Mar ... %BJanuary February ...
%dDay of month "01"-"31" %D%m/%d/%y
%eDay of month " 1"-"31" %HHour of day "00-23"
%hEquivalent to %b %IHour of day "01" - "12"
%jJulian day of the year "001" to "366" %mMonth of year "01" - "12"
%MMinute "00" - "59" %nNewline character
%pAM/PM %rTime in %I:%M:%S [AM|PM]
%R%H:%M %SSeconds, output as a number between "00" and "61"
%tTab character %T%H:%M:%S
%uDay of week (1 = Monday, 7 = Sunday) %wDay of week (0 = Sunday, 6 = Saturday)
%yYear (without century) "00" to "99" %YYear "0000" to "9999"
%ZTime zone ("GMT") %%"%"

TCP Statistics

The %{Statistic}c macro can be used to print statistics about the TCP connection on which the request was handled, if applicable.

The following statistics can be logged:

rtt
The average round-trip time for the connection between the client and the traffic manager, in milliseconds.
rttvar
The variance of the rtt figure. This is reported as the standard deviation of the round-trip time over the duration of the connection, in milliseconds.
cwnd
The size of the TCP congestion window between the client and the traffic manager, in number of segments.

Statistics are availble only for virtual servers whose underlying transport protocol is TCP, and only when running on a Linux platform. If the statistic could not be retrieved then '-' will be logged.


The Connection Management section allows you to configure settings that control how the virtual server manages connections from the remote client.

This page displays settings which are appropriate for the protocol the virtual server is managing, therefore some of the sections and settings mentioned may not be applicable.

HTTP-Specific Settings

These settings control how the virtual server handles HTTP traffic. They are only displayed if the virtual server internal protocol is set to HTTP.

keepalive

Should the virtual server use keepalive connections with the remote clients?

add_cluster_ip

Add an 'X-Cluster-Client-Ip' header to the HTTP request that gives the original client IP address. This may be required if webserver nodes must make decisions based on the client IP address, it could also be useful for debugging. Refer to 'transparency' in the user manual for an alternative approach.

add_x_forwarded_for

Like the add_cluster_ip setting, adds the original client IP address to the request but under the 'X-Forwarded-For' header. If an X-Forwarded-For header was already present in the request, then the client IP address will be appended to the existing value.

add_x_forwarded_proto

Add an 'X-Forwarded-Proto' header to the HTTP request that specifies the protocol used by the client to connect to the virtual server. This can be useful when running an SSL-decrypted virtual server as the web server will be informed that the client connected to a secure server even though it is receiving the request over HTTP. If an X-Forwarded-Proto header already exists in the request to the traffic manager it will not be altered.

Note that this setting will always be enabled if the virtual server has Aptimizer enabled.

mime!detect

The MIME Type is a component of an HTTP response that describes the type of data in the response – image, HTML page, etc. – so that the client can know how to render or process it. Some web servers and web applications do not correctly set the MIME type response header, and most client software is capable of detecting when this has occurred and auto-detecting the MIME type itself.

In certain circumstances, Stingray also needs to know the MIME type of a response. For example, Stingray will only attempt to compress certain types of HTTP response data; if the MIME type is missing or incorrectly identified, Stingray's content compression will not operate correctly.

In this situation, you can enable MIME-type detection to make Stingray apply a range of heuristics to deduce the MIME type of the response data. Auto-detection only takes place when:

  • There is a response body, and
  • The Content-Type header is missing, or it matches the value of mime!default, and
  • The response is not compressed

Stingray will de-chunk data if necessary, if chunk-transfer encoding was used.

You should only configure MIME Type auto-detection when absolutely necessary, as it will reduce the performance of the traffic manager.

mime!default

If a web server does not know the content type of a file, it will often send a default type instead. This is usually 'text/plain'. If Stingray sees this MIME type, it will ignore it and try to detect the correct type. This only applies if mime!detect is enabled.

http_chunk_overhead_forwarding

RFC 2616 describes a method of sending HTTP bodies without having to close the connection even if the content length isn't known in advance. This method, called "chunking," incurs some overhead on top of the actual payload data. Normally there is no reason to send packets that only contain overhead because there is no actual content to send. It's more efficient to delay sending the overhead until payload data becomes available and to send the chunking overhead together with the next block of content, as this minimizes the number of expensive write operations. Therefore, the default is to be "lazy" when it comes to forwarding such segments. However, some implementations of HTTP are not robust enough to handle this delay. For better interoperability with such peers, "eager" should be chosen.

Cookie settings

Defines how HTTP cookies are handled by Stingray.

cookie!domain

What Stingray should do with the domain portion of cookies set by a backend web server. You may need to change this if backend servers are using different domains to the one used the access them via Stingray. Web clients may not accept cookies if the domains mismatch. Options are:

  • Do not rewrite the domain
  • Rewrite the domain to the host header of the request
  • Rewrite the domain to the named domain value (see cookie!newdomain)
cookie!newdomain

The domain to use when cookie!domain is set to use a named domain value.

cookie!pathregex
cookie!pathreplace

These two configuration values work in conjunction as the search and replace portions of a regular expression (i.e. an s/search/replace/). If the cookie!pathregex value is specified the regular expression will be executed on the cookie path. If the regular expression matches the cookie path then the part of the path matched will be replaced by the string in cookie!pathreplace.

Additionally you can use captures in the cookie!pathregex and substitute the captured values within the cookie!pathreplace string using variables $1 to $9.

cookie!secure

The 'secure' tag in a cookie specifies whether or not it should only ever be sent over a secure (HTTPS) connection. Stingray can force this tag to be always set or unset using the cookie!secure setting.

Location Header settings

HTTP 'Location' headers can be used to redirect HTTP clients (web browsers) to alternative URLs with 301 or 302 HTTP responses. Since the virtual server may have been accessed using a different domain name and/or port than those used by backend web servers it is possible that location headers set by backend servers could redirect to an inaccessible URL, or inadvertently bypass the traffic manager. The settings in this section provide for the interception and alteration of HTTP location headers.

location!regex
location!replace

These two configuration values work in conjunction as the search and replace portions of a regular expression (i.e. an s/search/replace/). If the location!regex value is specified the regular expression will be executed on the HTTP response header 'Location' value, if present. If the regular expression matches then the part of the path matched will be replaced by the string in location!replace.

Additionally you can use captures in the location!regex and substitute the captured values within the location!replace string using variables $1 to $9. For example:

  • location!regex=(.*)www.example.com/products/(.*)
  • location!replace=$1products.example.com/$2
  • When the webserver returns a response like:
    HTTP/1.1 302 Moved Temporarily, http://www.example.com/products/hacksaw.htm
  • The response will be rewritten to:
    HTTP/1.1 302 Moved Temporarily, http://products.example.com/hacksaw.htm
location!rewrite

When the location!regex doesn't match or is empty, the location!rewrite setting provides a fallback/default behavior. Stingray can do one of:

  • Nothing;
  • Rewrite the hostname to the request's 'Host' header, and rewrite the protocol and port if necessary;
  • Do not rewrite the hostname. Rewrite the protocol and port if the hostname matches the request's 'Host' header.

Server First-Specific Settings

serverfirst_banner

Server-First protocols begin with a greeting string sent from the server as soon as the client connection has been accepted. By default Stingray will relay the backend node's greeting text. If an alternative greeting is desired this can be set here. Note that many protocols specify the format of this string, ensure the string you enter matches the requirements of the protocol being handled by the virtual server.

An advantage of specifying the serverfirst_banner is that Stingray can refrain from selecting a backend node until the first line of data has been received from the client. This means that rules can use the client data (i.e. username) to select the pool/node to use.

Stingray will automatically append a CRLF (Carriage-Return/Line-Feed) to the end of any string you enter here.

UDP-Specific Settings

These settings control how the virtual server handles UDP traffic. They are only displayed if the virtual server is managing UDP traffic.

udp_timeout

Stingray tracks UDP "sessions" based on IP addresses and ports, keeping hold of UDP metadata until a response is seen (see udp_response_datagrams_expected). If no response is seen within the specified udp_timeout the metadata will be discarded.

udp_response_datagrams_expected

The virtual server should discard any UDP connection and reclaim resources when the node has responded with this number of datagrams. For simple request/response protocols this can often be set to 1. If set to -1, the connection will not be discarded until the udp_timeout is reached.

udp_port_smp

If disabled, all UDP datagrams sent by the same client will be handled by the same traffic manager process and sent to the back-end node from the same source port. Some UDP protocols require this behavior as the server will not recognize that two requests are from the same client unless they are sent from the same source port.

If the udp_port_smp setting is enabled then UDP datagrams sent by the same client can be handled by different traffic manager processes, potentially improving performance. Datagrams from the same client could be sent to the back-end node from different source ports, however.

udp_endpoint_persistence

If enabled, UDP datagrams from same IP and port can be sent to same node in the pool if there's an existing UDP transaction. Although it's not always guaranteed as while making a decision to reuse same node, traffic manager can also apply other protocol specific filtering e.g CallID matching for SIP packets in addition to IP and port matching.

If disabled, UDP datagram will always use a new UDP transaction. This setting is recommended only for simple request/response protocols.

FTP-Specific Settings

These settings control how the virtual server handles FTP sessions. They are only displayed if the virtual server internal protocol is set to FTP. The default settings are configured for highest security; for more information on FTP security concerns refer to the FTP section of the Stingray User Manual.

ftp_force_client_secure

If enabled, Stingray will only accept incoming client data connections (passive/PASV mode) from a source IP that is the same as the source IP the client initiated the control connection from. If not enabled it is possible for a third party to intercept data channel traffic by connecting to the FTP server (Stingray) data port before the client does. This is enabled by default.

ftp_force_server_secure

If enabled, Stingray will only accept incoming server data connections (active/PORT mode) from a source IP that is the same as the server IP. If not enabled it is possible for a third party to intercept data channel traffic by connecting to the FTP client (Stingray) data port before the server does. This is enabled by default.

Specify a port range

When operating in passive mode (PASV) the Stingray FTP virtual server must listen on additional ports in order to accept data channel connections from clients. By default Stingray will choose a random high port. In some circumstances, such as for firewall policy enforcement, it may be necessary to restrict the range of ports used for FTP data connections. To do this enable this section and fill in the "Lowest port" and "Highest port" values, Stingray will pick random ports from within the range specified.

serverfirst_banner

When a client connects to an FTP server the server identifies its self with a 220 greeting. Typically this message will identify the server software and system, and sometimes include several lines of general notice text. By default the serverfirst_banner value is not set and Stingray copies the greeting from the backend node to the client. If you want Stingray to greet clients with a different message then set this value to the desired text.

An advantage of specifying the serverfirst_banner is that Stingray can refrain from selecting a backend node until the first line of data has been received from the client. This means that rules can use the client data (i.e. username) to select the pool/node to use.

Stingray will automatically append a CRLF (Carriage-Return/Line-Feed) to the end of any string you enter here.
ftp_data_source_port

In active (PORT) mode, Stingray must make a connection back to the client to send and receive data. By default Stingray will use a random source port for this connection. However, if a specific port is required, perhaps for firewall policy reasons, you can specify it with this configuration value. If you need to specify a port below 1024 you must also enable the ftp_data_bind_low setting in 'System > Global Settings > System Settings'.

SIP-Specific Settings

These settings control how the virtual server handles SIP traffic. They are only displayed if the virtual server internal protocol is set to SIP.

sip_transaction_timeout

SIP requests and responses are grouped into transactions. Each transaction consists of a request, its associated responses, and, in some cases, an additional request. A SIP client can send several transactions over the same connection.

This setting specifies the amount of time Stingray will wait before reclaiming the resources associated with a transaction when no further data has been seen on it.

sip_timeout_messages

When a SIP transaction times out, the traffic manager can send a 408 Request Timeout response to the client. When a transaction times out, no more responses will be sent from the server to the client. If the server does issue a response after the time out it will not reach the client.

In the case of an INVITE transaction, a CANCEL request will also be generated and sent to the server when a transaction times out.

sip_mode

SIP virtual servers can operate in several different modes. The mode that is selected affects the level of interaction Stingray has with the session being established.

  • SIP Routing: The first SIP request in a session will pass through Stingray, along with its responses, but all future requests that are part of the same session will go directly to the back-end node that was chosen by the traffic manager.
  • SIP Gateway: All SIP requests and responses will pass through the traffic manager.
  • Full Gateway: All SIP requests and responses and all session data will pass through Stingray. A port range to use for the session data and a timeout value for inactive data connections can be specified in the additional settings that are displayed when the Full Gateway mode is selected.
sip_rewrite_uri

If set, this option tells Stingray to replace the URI of incoming requests with that of the back-end node Stingray has selected.

sip_follow_route

If set, this option tells Stingray to follow the routing information contained within incoming requests. If there is a Route header the request will be sent to the corresponding destination. If there is no Route header, the request will be sent to the destination specified by the URI. If the URI points to Stingray then the request will be sent to the pool as normal.

This behaviour can be overridden by the sip_dangerous_requests setting. For example, if a request arrives that contains body data and a Route header, the Route will be ignored and the request sent to the pool if sip_dangerous_requests is set to send dangerous requests to a back-end node.

If sip_follow_route is set to No then all requests will be sent to the pool and will have a Route header added that corresponds to the chosen node.

sip_dangerous_requests

Stingray considers a request dangerous if its next destination is an external IP and the request contains body data. This setting controls the way Stingray handles such requests:

  • Send the request to a back-end node: Stingray load-balances the request to a back-end node.
  • Send a 403 Forbidden response: Stingray sends a Forbidden response back to the client, meaning any requests that are not addressed to your traffic manager's domain are rejected.
  • Forward the request to its target URI: Stingray processes the request as an outbound message and will forward it on to the destination specified by the routing information in the request. This setting is not recommended unless the virtual server is handling outbound SIP traffic.
sip_max_connection_mem

A client can send multiple SIP requests on the same connection and receive responses to them in any order. To stop a client from having an excessive number of active requests awaiting a response Stingray can limit the maximum amount of memory each connection can allocate.
The sip_max_connection_mem setting specifies how much memory Stingray should allow each connection to use before refusing new requests with a '413 Request Entity Too Large' response.
If this value is set to 0 then the memory limitations are removed, however this will leave Stingray more vulnerable to a Denial of Service attack.

RTSP-Specific Settings

These settings control how the virtual server handles RTSP traffic. They are only displayed if the virtual server internal protocol is set to RTSP.

rtsp_streaming_timeout

If no data is transmitted via a data-stream for this number of seconds the stream will be terminated, freeing resources associated with it. This does not terminate the RTSP connection.

Specify a port range

The virtual server needs to bind to additional ports for UDP streams between the client and server to allow streaming data delivery. By default, Stingray will choose a random high ports for this. In some circumstances, such as for firewall policy enforcement, it may be necessary to restrict the range of ports used. To restrict the range enable this section and fill in the "Lowest port" and "Highest port" values, Stingray will pick random ports from within the range specified.

Timeout Settings

These settings control how the virtual server handles connection timeouts for new and established connections.

connect_timeout

A connection that has not received any data should be closed after this number of seconds.

keepalive_timeout

How long should the virtual server keep an idle keepalive connection before discarding it?

timeout

A connection should be closed if no additional data has been received for this number of seconds.

max_transaction_duration

A connection should be closed if a transaction on that connection is taking longer than this number of seconds to complete.

Connection Error Settings

These settings control how the virtual server manages connection failures.

log!client_connection_failures

This controls whether the virtual server logs connection failures for client connections. This includes SSL failures caused by clients. You can use the System > Alerting page to specify what actions should be taken when a connection problem is reported. All connection problems are contained in the 'Connection Failures' Event Type.
A typical error log for a refused connection will look like this:

[16/Jun/2009:15:12:03 +0100] INFO vservers/VS1 connfail "Connect failure - Connection refused" S 10.100.10.44:43493 10.100.10.44:8080 "Pool1" "10.100.10.241:809" 58903 "-" c 513 0 0 0 1 1 1 0 - GET "10.100.10.44:8080/form.html"

Selecting a Connection Failure filter on the Event Log UI page will show formatted output of the log.

The format of these logs are :
TimestampTimestamp of the event.
Severity Connection failures and errors are severity INFO and ssl failures are severity WARN.
VS log tagvserver tag followed by the virtual server name.
Error event "connfail" for connection failures, "connerror" for protocol or transaction errors and "sslfail" for ssl failures.
Error message A textual description of the cause of the failure.
Client or Server This can be C or S depending on whether the failure is on client or server side.
Source address/portIP address and port of the client.
Destination address/portIP address and port of the server.
Pool name The pool selected for this request.
Node used The node selected for this request.
Local Port The local port of the connection made to the backend node.
Rule The rule currently executing, or most recently executed, when the error occurred.
Connection stateThe state of the connection when the error occurred.
Bytes received from clientBytes received by Stingray from the client.
Bytes sent to serverBytes sent by Stingray to the server.
Bytes received from serverBytes received by Stingray from the server.
Bytes sent to clientBytes sent by Stingray to the client.
Established since Time in seconds since the connection was established.
Client idle since Time in seconds since the client connection was idle.
Server idle since Time in seconds since the server connection was idle.
Connection retries No. of connection retries for this request.
Response code The response code sent by the server.
URL details This may optionally include the Request Method, URL and transaction number( for SIP ).

log!server_connection_failures

This controls whether the virtual server logs connection failures and protocol errors occurring on connections to nodes.
The format of the log entries is the same as mentioned above.

log!ssl_failures

This controls whether the virtual server logs failures from ssl handshakes with clients and servers.
The format of the log entries is the same as mentioned above.

error_file

This configures the message contents to be sent in the error message to the client when Stingray detects an internal or backend error. The "Default" value sends a default error message constructed by Stingray.
The error file should be larger than 512 bytes otherwise some browsers, e.g. Internet Explorer, may ignore the contents of the file.

Stingray is capable of processing HTTP headers within your error file, regardless of the actual file type, when you wish to set explicit directions on how the file should be handled. For example, you could set the Content-Type header if you wish to display a file of a particular type, such as a GIF or JPG image file. In this case, you would append the following lines to the top of your binary file:

Content-Type: image/gif
 

It is important to remember to include a blank line after any headers, before the actual content of the file.

This capability can be extended to override the HTTP response code, as per the following example:

HTTP/1.1 200 OK
 

This would force Stingray to return the desired code in its response to the client.

Memory Limits

These settings control how much memory the virtual server uses for each connection.

max_client_buffer

How much memory should the virtual server use to store data sent by the client? Larger values will use more memory, but will minimize the number of read() and write() system calls that Stingray must perform.

Note that for the HTTP protocol, Stingray will reject requests whose HTTP headers are larger than this setting, since it cannot decide what to do with a request until it has seen all the headers.

max_server_buffer

How much memory should the virtual server use to store data returned by the server? Larger values will use more memory, but will minimize the number of read() and write() system calls that Stingray must perform.

Low Level Settings

proxy_close

When enabled, Stingray will send the client FIN to the back-end server and wait for a server response instead of closing the connection immediately. This is only necessary for protocols that require half-close support to function correctly, such as 'rsh'. Setting this key also makes Stingray itself support half-closed connections, i.e. if Stingray generates the response in a request rule, it will continue to create and send the response even after it has received a FIN from the client.

so_nagle

Whether or not the virtual server uses the Nagle algorithm (designed to improve the efficiency of the network).


The Pools page lists the pools you have created.

Your Pools

Each listed pool shows the protocol it is balancing, and how many nodes it contains. You can view a brief configuration summary for each pool by unfolding its display.

To edit a pool, click on the pool name or the Edit Pool button alongside it.

Create a New Pool

You can create a new pool to load-balance traffic across a group of server nodes.

Pool names should be a short description, and cannot contain reserved characters like '!', '.', '/' or '\'. We recommend names like Mailserver pool.

You can rename a pool by editing the name field on the Pools Edit page.

The 'nodes' field is used to specify the server nodes that Stingray will use to handle connections. Each node consists of its hostname (or IP address) and port number for the remote service, e.g. 'server1.zeus.com:80'. Multiple nodes can be entered by putting a space between each node. After creating the pool, nodes can be added and removed by viewing the pool's edit page.

The 'Monitor' box is used to select how Stingray will check that the remote services are still running. The default monitor is 'ping', which will send a network ping packet to each node to check that it is still alive.


This page displays the configuration for a pool and allows you to edit its basic settings.

At the top of this page is some basic information on this pool, including which virtual servers and pools use it. A pool may be used by a virtual server because it is referred to in a TrafficScript rule using the 'pool.use()' command, or because it is the default traffic pool for that virtual server. A pool will be used by another pool if it is the failure pool for that pool.

Basic Settings

This section allows you to rename your pool, and change its basic, fundamental properties.

Name

Pool names should be a short description, and cannot contain reserved characters such as '!', '/' or '\'. We recommend names like Mailserver pool.

You can rename a pool by editing this field. If you rename a pool, virtual servers using it as their default pool and pools using it as their failure pool are updated to refer to the new name.

If you rename a pool TrafficScript rules that refer to the pool are not updated.

Pool nodes

This is a group of server machines and ports onto which this pool balances traffic.

Nodes can be set to 'draining' by selecting the 'Draining' option from the drop-down State box next to the node's name on this page, or by using the 'Drain a node' wizard. When a node is draining, it will not receive any new connections other than those in sessions already established. To remove a node from a pool safely, it should be drained first.

Nodes can also be disabled from this page by selecting 'Disabled' as the node's state. When a node is disabled, all currently established connections to that node will be terminated and no further requests will be sent to it. The node will still remain in the list, ready to be added again when it is needed. Any weighting priorities set in the Load Balancing section will be remembered.

Add Node

Extra nodes can be added to the pool by entering their hostname (or IP address) and port here, e.g. 'server1.zeus.com:80'

Failure pool

If all of the nodes in your pool have failed, requests can be diverted to a failure pool.

It is a good idea to configure a failure pool, even if it just returns a static page saying 'we have a problem; please come back later'.


The pool load-balances connections across the server nodes it is managing. Load balancing is the process of choosing the most appropriate node for the request based on various criteria. The goal of load balancing is often to minimize the response time for the request.

Load Balancing Algorithms

Stingray supports a range of load balancing algorithms:

Round Robin

This algorithm distributes traffic by assigning each request to a new node in turn. Over a period of time, all the nodes will receive the same number of requests.

Weighted Round Robin

Weighted Round Robin works in a similar way to Round Robin, but assigns more requests to nodes with a greater 'weight'. Over a period of time, nodes will receive a number of requests in proportion to their weight.

Weights can be specified for your nodes using the entry boxes provided. You must use positive integer values; a node with a weight of '4' will receive 4 times as many requests as a node with a weight of '1'.

Perceptive

The Perceptive algorithm uses a combination of response time data and connection counts to predict which node is likely to have the fastest response time for each request. This algorithm is tuned dynamically by traffic manager depending on the traffic conditions.

Least Connections

This algorithm sends each new request to the node with the fewest currently active connections. During periods of high traffic, each node should be handling a similar number of connections. Faster nodes should respond to requests faster, and so will be given proportionally more requests to process over time.

Weighted Least Connections

This algorithm works in a similar way to the Least Connections algorithm, but assigns more requests to nodes with a greater 'weight'. Weights can be specified for your nodes using the entry boxes provided.

Requests are distributed across nodes based on the number of active concurrent connections. However, the weightings affect the proportion of connections each node receives. A node with a weight of '4' is 4 times as likely to receive requests than a node with a weight of '1'.

Fastest Response Time

The Response Time algorithm monitors the response times for recent requests to each node. It sends each new request to the node that has recently been responding the most quickly.

This algorithm seeks to minimize the response time for each request. It has a similar effect to the Perceptive algorithm, but is based purely on historical data and may not behave as well when the traffic type is changing or very varied.

Random Node

This algorithm chooses a random node for each request. Over a period of time, each node should receive a similar number of requests.

Note that node weightings cannot be switched between single and multiple location-based input like other areas of the Stingray UI. Instead, if you have chosen to configure your nodes by location, the associated weightings will automatically be displayed by the locations used.

Choosing a suitable load balancing algorithm

First of all, if you are balancing a protocol with long-lived connections (e.g. IMAP or RDP), you should choose the Least Connections algorithm.

For other traffic (e.g. HTTP), the Perceptive, Least Connections and Response Time algorithms will all balance traffic well and adjust for slower machines automatically. Load balancing based on response times can sometimes react slowly to an overloaded machine (i.e. the machine has to get overloaded before its response times slow down), so often the Least Connections is a good overall choice.

Round Robin may be the simplest algorithm, but is still very effective when you have a group of similar machines and regular traffic.

Priority Lists

The Priority Lists interface allows you to partition your pool into fail-over groups. If a number of machines in the highest priority group fail, the machines in the group below will start taking up their traffic.

Groups can be created by clicking on the arrow buttons.

A new group is created when a node is moved above the top group or below the bottom group
e.g. to create three groups you can either:

  1. Move all the high priority nodes up, then move all the low priority nodes down.
  2. Move all the higher priority nodes up, then move all the highest priority nodes up further.


Session persistence classes can be used to direct all requests in a client session to the same node. This may be necessary for complex applications, where an application session may be maintained over a number of separate connections. Examples of this include web-based shopping carts, and many complex UDP-based protocols.

Whenever a pool receives a new request which is not part of an established session, it will use the load-balancing algorithm to choose the optimal server node to assign the request to.

When a pool receives a request that is part of an existing session, session persistence will endeavor to send that request to the same node.

Sessions will survive changes of destination port, such as when changing from HTTP (80) to HTTPS (443) to enter the secure section of a web site.

Use of the Traffic IP Groups setting 'consider client source port' can conflict with certain Session Persistence classes. With this setting enabled, requests from shared IPs could be distributed between different machines regardless of the persistence class(es) used. Please see the relevant section on the Traffic IP Groups Edit page for more details on its use.

Care must be taken when using a persistence class that is already in use by another pool. You should only re-use a persistence class if the nodes in this pool match those in the pool already using the class. Session affinity can not be guaranteed where a persistence class is in use by two or more pools with different nodes.

Applying a Session Persistence Class to a Pool

To apply session persistence to a pool, select a session persistence class and click the Update button.


Bandwidth Management classes are held and edited in a catalog and applied to a pool. The settings in a bandwidth management class are applied to the request data for each connection. The bandwidth management class used by a connection can be changed using a TrafficScript rule.

Applying a Bandwidth Management Class to a Pool

To apply bandwidth management to a pool, select a bandwidth management class and click the Update button.


Monitors watch the nodes in a pool, and inform Stingray if the nodes are functioning correctly. They work by sending small requests that expect a set reply. If they don't receive the reply they want, the test fails and Stingray is notified.

A monitor sending test requests will increase the load on a pool, albeit by a small amount. You should ensure that your back-end servers can handle the traffic produced by the monitors. You can alter the frequency of the monitors, to avoid generating excessive load.

Stingray contains a number of preset monitors. Some of these deal with generic TCP client-first or server-first protocols, and others are protocol-specific.

For more details on the built-in monitors and how to create a custom monitor see the Monitors Catalog.

You can edit the preset monitors in the catalog i.e. modify the timings, failure conditions, and logging, along with any other monitor-specific settings (such as the web page to request).

The Client First TCP transaction monitor requires you to set the data to write to the connection, in order to function properly.

You can choose whether your monitor should be per-node or pool-wide. If it is pool-wide, you must specify a machine (and possibly port) for the monitor to test, such as an NFS server used by the pool.

Be careful to set sensible timeouts for your monitors. Stingray will warn if you assign a HTTP or TCP monitor to a pool and the monitor has a shorter timeout than the pool.

Passive Monitoring

This setting determines whether Stingray will check that 'real' requests (i.e. not those from the monitors) are working. In normal use, Stingray will notice if a node is refusing connections, responding too slowly, or sending back invalid data. If it sees problems, then Stingray will mark that node as failed, and stop sending requests to it.

If this is disabled, you will need to ensure that there are suitable health monitors configured to check your servers instead, otherwise failed requests will not be detected and subsequently retried. You might want to disable this option if your servers do not always reply to all requests.


Stingray can encrypt the data that it sends to back-end nodes using SSL. This will stop others from reading the network traffic between Stingray and the nodes.

Don't confuse SSL encryption with SSL decryption! SSL decryption can be performed by the virtual server when clients send SSL traffic to Stingray, whereas SSL encryption is performed on the traffic Stingray sends out to the nodes.

You can use SSL encryption and SSL decryption at the same time, to protect all of your network traffic.

SSL Encryption

These settings control the SSL protocol configuration used for connections to the back-end nodes.

ssl_send_close_alerts

It is common for SSL clients to omit the final close alert when shutting down an SSL connection. However, some servers, especially FTP servers, are strict when it comes to handling close alerts and will fail to function properly if the alerts are omitted. Close alerts are disabled by default because they can break some older SSL implementations. You can also modify this behavior on the fly using TrafficScript rules.

ssl!support_ssl2
ssl!support_ssl3
ssl!support_tls1
ssl!support_tls1.1

These flags can be used to override the global setting for the given SSL/TLS version for this pool. Use to enable or disable support for specific SSL/TLS versions for connections to the back-end nodes of this pool.

ssl!ssl_ciphers

This is a list (space, comma or colon separated) of cipher suites that will be used for connections to back-end nodes of this pool. The list is sent to back-end nodes in the specified order. A back-end node might however enforce its own cipher suite preference on the connection. A blank value means that the global default will be used.

Please refer to the global setting ssl!ssl3_ciphers for more details.

smtp!send_starttls (SMTP only)

If enabled, Stingray will issue a STARTTLS request to the back-end server when a connection has been established. If the back-end server supports the Secure SMTP extension then a secure connection will be negotiated to transfer the SMTP data.

Checking The Identity of Nodes

When Stingray makes a SSL connection to a server, it will send back a SSL certificate. This certificate shows the identity of the server. SSL certificates are signed by a Certificate Authority (CA). If Stingray is to trust the identity of the server, it must first trust the CA that issued the certificate. To do this, you must supply Stingray with the details of each trusted CA. See the Certificate Authorities and Certificate Revocation Lists Catalog page for more details.

ssl_server_name

Enabling this setting will allow the use of the server_name extension from the TLS (Transport Layer Security) protocol, from at least version 1.0, in order to assist back-end nodes in providing the correct SSL certificate. The hostname comes from the pool's configuration, not any SSL client. The hostname can be overridden using TrafficScript.

Check that your nodes support TLS Server Name Indication before relying on this feature.

ssl_strict_verify

Enabling this option forces stricter checking of the certificates of back-end nodes. Certificates will be rejected if they don't match the server name, are self-signed, expired, revoked, or have been signed by an unknown Certificate Authority.

Confirming The Identity of the Traffic Manager

If the servers want to check the identity of the traffic manager, they will request a Client SSL Certificate. See the Client Certificates Catalog page for more information on client certificates.

ssl_client_auth

Enable this to allow Stingray to send SSL client certificates to back-end nodes, if requested by the servers.

For more information see the Certificate Authorities and Certificate Revocation Lists Catalog or the Client Certificates Catalog.


This page allows you to configure settings that control how the pool manages connections to its nodes.

The settings that are displayed may vary according to the protocol the pool is managing.

Settings

IP Transparency settings

transparent

Should connections to the back-ends appear to originate from the source client IP address? IP transparency requires appropriate kernel support and correctly configured routing tables on the server machines. Please refer to the manual for details before using this feature.

Connection Management settings

keepalive

Should the pool maintain HTTP keepalive connections to the nodes to process requests more quickly? If not, a separate node connection will be established for each client request.

keepalive!non_idempotent

If enabled, HTTP keepalives will be used for non-idempotent requests (e.g. POST requests) as well.

max_idle_connections_pernode

What is the maximum number of unused HTTP keepalive connections that Stingray should maintain to an individual node for re-use? Zero signifies no limit. This is a per pool configuration, so a node with the same IP:Port in different pools will honour max_idle_connections_pernode of the pool it belongs to.

max_connect_time

How long should the pool wait for a connection to a node to be established before trying another node? This has no effect on UDP or on pools where passive_monitoring is disabled.

max_reply_time

How long the pool should wait for a response from the node before either discarding the request or trying another node (retry-able requests only). Only the first byte of the response needs to be received from the node before this time.

max_connection_attempts

If the traffic manager fails to obtain a response from a server to which it has attempted to send data, the request will be tried against other nodes in the pool. The request must be retryable for this to happen (such as an HTTP GET request, or an HTTP POST request marked as idempotent in TrafficScript), and passive monitoring must be enabled.

The max_connection_attempts setting allows the number of attempts the traffic manager will make to obtain a response from a node to be restricted.

If max_connection_attemtps is set to 0, the traffic manager will try the request against every live node in the pool until it obtains a response. If all nodes in the pool have been attempted without success and a failure pool has been configured, the traffic manager will then attempt to send the request to nodes in that pool. If all nodes have been attempted without success, the traffic manager will close the connection and, depending on the protocol, will an error response to the client.

If max_connection_attempts is non-zero, the traffic manager will close the connection and, depending on the protocol, send an error response to the client if the specified number of connection attempts have been made without success. The failure pool will be attempted only if the number of live nodes in the primary pool is less than the configured maximum number of connection attempts.

Connections to nodes can fail for a variety of reasons, such as the server being down, the connection taking too long to establish, or no data being received from the server before the max_reply_time setting is exceeded (see also the max_timed_out_connection_attempts setting below).

max_timed_out_connection_attempts

This setting allows finer control over the number of times a request will be retried should it exceed the max_reply_time setting without receiving any data from the server.

If set to 2, for example, the first time a connection times out before receiving any data from the server will cause the request to be sent to another node. If that connection also times out before any data is received from the server then an error response will be sent to the client and no further nodes will be tried.

If set to 0 then no limit is placed on the number of nodes that are attempted.

Note that connection failures that contribute to the max_timed_out_connection_attempts count also contribute to the max_connection_attempts count.

max_connections_pernode

The maximum number of simultaneous connections allowed to each node in this pool. This is a per pool configuration, so the same node( same IP:Port ) in different pools can have different connection limits. This count is not shared among machines in a cluster, therefore each active machine in a cluster can make this number of connections to a node.

queue_timeout

A request is queued if it cannot connect to a node due to max_connections_pernode. This parameter specifies the amount of time a request can remain queued. On a timeout, the client will be sent an error response (according to the error_file configuration key or the default error message). A connection error will also be logged if log!server_connection_failures is enabled.

max_queue_size

The number of connections that can remain queued while waiting for free connections to a node.

node_connection_attempts

The number of times the software will attempt to connect to the same back-end node before marking it as failed. This is only used when passive_monitoring is enabled.

node_fail_time

The amount of time, in seconds, that a traffic manager will wait before re-trying a node that has been marked as failed by passive monitoring.

node_connclose

Close all connections to a node once we detect that it has failed.

node_so_nagle

Whether or not Nagle's algorithm should be used for TCP connections to the back-end nodes.

ftp_support_rfc_2428

Whether or not the backend IPv4 nodes understand the EPRT and EPSV command from RFC 2428. It is always assumed that IPv6 nodes support these commands.

UDP Response Handling

udp_accept_from

Select from the drop-down list how the traffic manager should receive responses to UDP requests. The options provide a varying degree of trade-off between security and compatibility. The most secure option is to accept responses from only the IP address and port to which the original request was sent. UDP responses can, however, be sent from any IP and port so additional options are provided to allow responses from any port and from certain groups of IPs. You should choose the setting that most closely matches how your UDP server responds to requests.

If you choose to accept responses from only a specific set of IP addresses, you will need to enter a CIDR Mask (such as 10.100.0.0/16) in the box provided.


This section allows you to specify how the Traffic Manager scales a pool up and down automatically.

Introduction

Auto-scaling works if the nodes of a pool are instances of images running in a cloud environment. The traffic manager using and controlling these instances does not have to be in the same cloud itself, but there are some advantages to placing it there, lower latency, for example.

Cloud Credentials

In order to be able to dynamically create and destroy instances in a cloud and use them as nodes in pools, the traffic manager has to know the authentication details of a cloud user. Such a user must be registered with the cloud provider and all usage costs will be billed against this account. For more details on Cloud Credentials, see Cloud Credentials.

Basic Settings

autoscale!enabled

Turns autoscaling on or off for a pool. By default, pools are not auto-scaled; to enable autoscaling, set this key to 'Yes'.

autoscale!external

This settings determines whether the scaling logic and the actual provisioning of nodes is performed by the traffic manager or by an external system, such as RightScale.

If an external system is monitoring, provisioning, and destroying auto-scaled nodes, set autoscale!external to 'Yes'. The external system is then responsible for communicating the details of the nodes currently present in the auto-scaled pool to the traffic manager so it can distribute incoming requests between them. The external system will typically communicate this information through the traffic manager's control API.

If set to 'No', you can use the scaling parameters found on this page, such as autoscale!response_time, to control when the traffic manager will provision a new node and when it will remove an existing node from the pool.

The traffic manager will use the cloud API defined by the appropriate Cloud Credentials to provision new nodes. The instance settings, such as autoscale!imageid, found on this page can be used to specify what type of node the traffic manager will create when it needs to scale the pool up.

autoscale!cloudcredentials

In order to use a cloud's API, credentials have to be provided. Sets of cloud credentials can be pre-configured under Catalogs > Cloud Credentials. This drop-down menu lets you decide which credentials to use for a given auto-scaled pool. For details on how to configure cloud credentials, please refer to Cloud Credentials.

Node Settings

autoscale!min_nodes

The minimum number of nodes the traffic manager will always keep in the pool even if the response times are such that less nodes would be acceptable.

autoscale!max_nodes

The maximum number of nodes to add to a pool. Even if response times deteriorate, the traffic manager will not create more than max_nodes nodes.

autoscale!port

The port which the virtual server should contact on the nodes in this pool.

Cloud Settings

autoscale!imageid

The identifier of the image from which to create instances. This determines which operating system and services will be running on the nodes. This parameter is called imageId by Rackspace and ImageId by EC2. For Rackspace, the internal identifier has to be used; to get a list of the image identifiers available to a given set of cloud credentials, run the rackspace.pl script manually like this:

 # $ZEUSHOME/zxtm/bin/rackspace.pl listimageids --cloudcreds=rackspace_credentials
           
Here, 'rackspace_credentials' has to be replaced by the name of the Rackspace cloud credentials. The resulting list will look similar to this (the first number in each line is the internal id):

29      Windows Server 2003 R2 SP2 x86
41      Oracle EL JeOS Release 5 Update 3
53      Fedora 13 (Goddard)
187811  CentOS 5.4
4       Debian 5.0 (lenny)
10      Ubuntu 8.04.2 LTS (hardy)
17      Fedora 12 (Constantine)
23      Windows Server 2003 R2 SP2 x64
24      Windows Server 2008 SP2 x64
49      Ubuntu 10.04 LTS (lucid)
...
           

autoscale!sizeid

The identifier for the size of the virtual machine to create for instances of nodes created for this pool. In EC2, this is known as the InstanceType, Rackspace calls it the FlavorId. Usually, more powerful machines are associated with higher costs. For Rackspace, the internal identifier has to be used; to get a list of the size identifiers available to a given set of cloud credentials, run the rackspace.pl script

 # $ZEUSHOME/zxtm/bin/rackspace.pl listsizeids --cloudcreds=rackspace_credentials
           
Here, 'rackspace_credentials' has to be replaced by the name of the Rackspace cloud credentials. The resulting list will look similar to this (the first number in each line is the internal id):

1       256 server
2       512 server
3       1GB server
4       2GB server
5       4GB server
6       8GB server
7       15.5GB server
           

autoscale!name

An identifier to store with each instance that allows the traffic manager to map nodes in the cloud to auto-scaled pools. Not all clouds support this, however (EC2, for instance does not associate names with instances).

autoscale!securitygroupids

List of security group IDs (sg-*) to associate to the new EC2 instance. A security group acts as a firewall that controls the traffic for one or more instances.

autoscale!subnetids

List of subnet IDs where the new EC2-VPC instance(s) will be launched. Instances will be evenly distributed among the subnets. If the list is empty, instances will be launched inside EC2-Classic. Nodes can be distributed across availability zones by specifying subnets associated with different availability zones.

autoscale!ipstouse

Instances in cloud environments often have (at least) two IP addresses, one on a private interface for communication with other nodes in the same cloud, and one on a public interfaces for communication with the internet at large. If the traffic manager is in the same cloud as the back-end nodes, use the private IP addresses, otherwise the public ones.

Instances inside EC2-VPC do not have a public IP by default. Please set autoscale!ipstouse to "Public IP Addresses" to assign one at creation time.

VMWare vSphere settings

Introduction

The Stingray Traffic Manager has the ability to autoscale nodes on a VMWare vSphere infrastructure. The autoscaler on the Stingray Traffic Manager uses a built-in script to communicate with a vCenter server to scale VM's. The infrastructure on a vCenter server usually has a datacenter at the top level, which contains ESX hosts or a cluster of ESX hosts. If a cluster is configured with vSphere DRS, then new VM's are placed on automatically chosen ESX hosts.

VMware Template

The built-in VSphere autoscaler script creates new VM's by deploying them from existing VM templates. VM templates are pre-configured VM's which are marked as a template on which new VM's can be based on. The path of the VM template on a vCenter server is usually of the form <DatacenterName>/vm/<TemplateName>.

Name Prefix

New nodes will be created with this name prefix on the vCenter Server. If multiple pools are autoscaling on the same vSphere Infrastructure, then care must be taken in keeping the name prefixes for each pool unique.

Data Center

All ESX hosts managed by the vCenter server are put in logical datacenters. Auto-scaling is done on the hosts or clusters contained within this datacenter.

Data Store

The datastore that will be used by the newly created VM's. If not mentioned, then the default datastore used by the datacenter will be used ( depends on vCenter configuration ).

If the datastore is mentioned then the template should also be using the same datastore.
VMware ESX Cluster

If a cluster is configured with dynamic resource scheduling( DRS ), vCenter decides the hosts on which new VM's will be placed. If no cluster is configured, then this setting will contain the ESX hostname or IP where the new VM's will be created.

Scaling Parameters

autoscale!response_time

In order to be able to decide whether more or fewer nodes are needed in a pool, the traffic manager monitors the response times of the nodes in the pool. This is the time from initiating the connection to receiving the first byte of the response. Response times up to this configuration value are considered conforming, longer response times are not conforming. The traffic manager continuously monitors the percentage of conforming responses.

autoscale!scaledown_level

When the percentage of conforming responses rises above this value for at least 'autoscale!hysteresis' seconds, the pool is scaled down, i.e., a node is removed from the pool.

autoscale!scaleup_level

When the percentage of conforming responses falls below this value for at least 'autoscale!hysteresis' seconds, the pool is scaled up, i.e., a node is added to the pool.

autoscale!refractory

After a change to the pool size has been made (be it an increase or a decrease), the traffic manager will wait a while before making another change. It will take some time for the new node to have its effect on the overall response times of the pool, so to if you are experiencing overshoot, try changing this value.

autoscale!hysteresis

It may not be ideal to react to the slightest change in response times by creating a new (or removing an old) node for the pool. By setting the hysteresis time to a value greater than zero, you can avoid short-lived fluctuations of the pool size and react only to long-lasting changes in response times.


This page provides a summary of all of your Stingray configuration, giving you a global view of your settings.

Most items in the configuration summary are links, taking you to the edit page for that particular object. This makes the summary page a quick way of navigating around your entire configuration.

Understanding the Configuration Summary page

The configuration 'grid' consists of three main sections, two of which are collapsible for maximum flexibility using the arrows at the top left of each section. The left-hand section is always visible and lists the virtual servers defined on the system along with the traffic IPs/groups/ports that this server is listening on.

Reading across the table into the middle section shows the dependencies in your configuration. Scanning from left to right, the table shows the rules that each virtual server uses, the pools that the rules pick, and the nodes contained in those pools. The right hand section shows the optional classes assigned to the virtual servers and pools, such as monitors, which check that the pool nodes are working correctly.

The grid is sorted and grouped by the highlighted column. You can select which column to sort on by clicking the header text. An arrow next to the sorted column header shows the direction of sorting, ascending or descending alpha-numerically. Clicking on the header will toggle the sort direction between the two. Initially the summary is sorted based on the 'Virtual Servers' column. This means that the summary will sort your configuration alphabetically by virtual server and group together all the objects (rules, pools, etc.) associated with a server on one row. If a server uses several rules, each rule will appear as a sub-division of the row and then the pools, nodes, monitors etc. will flow to the right of the appropriate rule in this sub-row. Further sub-divisions will occur where needed, thus allowing for a sideways tree structure to develop out from the originating virtual server. A new major row will be started for each new virtual server that is found in your configuration.

Configuration items defined but not currently in use by a virtual server will be shown at the foot of the table in a separate row marked "Unused".

If you want to quickly see which virtual servers use a particular monitor, unfold the right-hand section and click on the 'Monitor' column heading. The table will be redrawn, and all the pools using that monitor will be sorted into a single row in the table.

If you have a particularly large configuration, you can shrink the configuration summary by 'folding' particular rows - click on the arrows on the left hand side of the table. Alternatively, all rows can be folded or unfolded simultaneously by clicking the links at the top of the page.

Exporting your configuration

You can download your configuration in this section in the form of a TAR archive file. Archives of this type can be uploaded on the Backups page. The backup file will contain sensitive information including all SSL keys not stored on secure hardware. It should be kept secure.


This page diagnoses faults with the Stingray cluster. Various tests are performed to determine any faults in the cluster and configuration.

Some sections listed on this page may not necessarily appear in your Diagnosis UI. If you have not configured a particular feature within Stingray, are not licensed to use a particular feature, or if there is simply nothing to report, then Stingray may not show that section in order to keep the page content simple and easy to read. Core features, however, will always be shown regardless of their current state.

Traffic Managers

This section is used to check that configuration is synchronized between traffic managers.

Virtual Servers

This section is used to check that no errors are reported against any configuration file.

Pools

This section is used to ensure that the back-end nodes are available, and to help diagnose the problem if a node is uncontactable.

Stingray Application Firewall

This section shows any problems with the Stingray Application Firewall, if it is installed on any traffic managers in your cluster.

TrafficScript

Any problems with TrafficScript Rules are reported in this section.

Java Extensions

Any problems with the Java Extensions are reported in this section. Common issues are often related to the configuration of Java files.

Service Level Monitor

Any problems with the SLMs classes are reported in this section.

Files

Any missing or corrupted configuration files are reported in this section.

Other

Any other problems are reported in this section.


The Event Log displays interleaved logs, each tagged with the originating traffic manager's hostname.

Options

This page automatically updates in real time as new events occur, with the most recent events added to the top of the page. You can temporarily halt updates by clicking Stop updating; new events only being displayed when the Display button is used. Click Resume updating to restart automatic page updates.

The options provided enable you to select machines in your cluster from which to retrieve logs, the length of time to search back in the chosen logs and to filter events based on event types. You can also filter out insignificant events.

To ensure that the log page loads within a reasonable length of time you can restrict the log size. The logs will show only the most recent events from each traffic manager (roughly 10k from each).

You can also choose to download the logs to disk using the Download button. It is not recommended that you choose a time scale of 'All Logs' when downloading the Event Log as the resulting file could be very large.

To clear out the event log tick the confirm box and press the Clear Event Log button. Clearing the event log will permanently remove the logs from all traffic managers. If you want to preserve the logs you should back them up first.

To download the complete log for this traffic manager press the Dowload Local Event Log button.

Event log automatic rotation

On a Stingray Appliance, event log files are automatically rotated when they have 50MB. The most recently rotated log is included in the display and download operations on this page. Earlier rotated logs are compressed and can be downloaded from the Event Archive page.


Archived Event Log Files

On the Stingray Appliance automatic rotation of the Event Log prevents excessive disk use. When the Event Log file grows to 50MB or more, its contents will be archived. The most recent archive is included in the operations on the Event Log page. Earlier files are compressed with the gzip compression method and stored under a name containing the date and a sequential number. These files can be downloaded and deleted via the UI.

Downloading Archived Event Log Files

To download an archive, click on the Download button of the file you are interested in.

Deleting Archived Event Log Files

To delete archives, mark them for deletion by ticking the check-box in column Delete for the files in question and confirm the step by clicking the Delete button at the lower right of the page.


The Audit Log displays users' activities, where each action is tagged with the originating user and the IP address of the client machine.

Options and filters

The main option here is the amount of events to display. You can select a time period, or last N events (where you can specify N in the box provided).

Click on the small triangle to display or hide the filter controls. The filters enable you to display events that match a set of specified values for:

Multiple IP addresses can be specified using an IP/Mask combination, and regular expressions can be used for the other fields. Click Display to update the results.

You can also choose to download the logs to disk using the Download button. It is not recommended that you choose a time scale of 'All Logs' when downloading the Audit Log as the resulting file could be very large.

To download the complete log for this traffic manager press the Dowload Local Audit Log button.

Audit log automatic rotation

On a Stingray Appliance, audit log files are automatically rotated when they have 50MB daily. The most recently rotated log is included in the display and download operations on this page. Earlier rotated logs can be downloaded from the Audit Archive page.


Archived Audit Log Files

On the Stingray Appliance automatic rotation of the Audit Log prevents excessive disk use. When the Audit Log file grows to 50MB or more, its contents will be archived. The Audit Log file is archived each day. The most recent archive is included in the operations on the Audit Log page. Earlier files are compressed with the gzip compression method and stored under a name containing the date and a sequential number. These files can be downloaded and deleted via the UI.

Downloading Archived Audit Log Files

To download an archive, click on the Download button of the file you are interested in.

Deleting Archived Audit Log Files

To delete archives, mark them for deletion by ticking the check-box in column Delete for the files in question and confirm the step by clicking the Delete button at the lower right of the page. Only the Audit User can delete audit log archives, and only after 1826 days (by default). This setting can be changed by setting auditlog!mandatory_retention to the number of days required in the global.cfg configuration file.


Querying Riverbed Technical Support

If the provided sources of information do not help resolve the problem, customers with a Support contract or Evaluators of the software can use our Support Service.

Click "Generate Technical Support Report" to begin creating a report. If Technical Support has requested that you include more information in the report you can customize the TSR on the following page.


Querying Riverbed Technical Support

Stingray has been designed to collect its configuration and diagnostic information and store this in a report that can be sent to your support provider for review.

Please download the Report and email it to your support provider including:

Your email must include your Customer number in the Subject line e.g.

Subject: [CABC 123] Need help debugging Traffic Script Rules

The Technical Support Report includes your current configuration, system information and diagnostics output, in 'tar' format. It does not include any SSL keys.

TSR Options

Occasionally, Technical Support may request more information to help solve the problem. When they do, you can use the form on this page to select or deselect the customizable components of the TSR.

If you stay on the progress page while creating the TSR you will be prompted to download it to your local machine when it is complete. If you navigate away from the page, you will not have this prompt. In this case, you will be able to download it later using the "Previous Reports" section on this page. You can also download any of the 10 most recently generated reports from this section.

To delete old Technical Support Reports, tick the boxes next to the reports you want to delete, tick the confirm box and click "Delete". You can delete multiple reports at once.


Downloading Support Files

This section allows you to download files, such as network traffic capture files, created by the Stingray Maintenance CLI.

To download a file, click the 'Download' button next to its entry in the list.

To delete files, select the files that you want to delete from the list, then select the 'Confirm operation' check box and click the 'Delete selected' button.


The Current Activity Graphs show the level of traffic going through your cluster as it happens.

The extra-large activity graphs are ideal for displaying your traffic on a plasma screen in the foyer of your company. Photographs of such set-ups are gratefully received by Riverbed.

Useful Settings

Linear Scale

This provides a standard fixed linear scale. It is useful for plotting relatively similar data values, however negligible plot points may be hidden against considerably larger amounts.

Logarithmic Scale

This is useful for plotting small amounts of data against large amounts e.g. BytesIn plotted against BytesOut on an HTTP server.

Pie Chart

The Pie Chart can be used to compare similar values, such as the traffic to each node in a pool. It plots the average of the last 5 seconds of data for each value it is measuring.

Downloading the graph data

The Download Data option allows you to get a copy of the data that has produced the current graph. It is a tab-separated file suitable for import into a spreadsheet application.


To change which values to plot in an activity graph:

To delete a setting you have saved, use the Delete button. However, you can't delete the preset settings that are included with the software; this will just reset their values.


The Historical Activity Graphs can show the traffic that has passed through your cluster over the last 30 days.

Useful Settings

Linear Scale

This provides a standard fixed linear scale. It is useful for plotting relatively similar data values, however negligible plot points may be hidden against considerably larger amounts.

Logarithmic Scale

This is useful for plotting small amounts of data against large amounts e.g. a fail pool plotted against a streaming media pool.

Downloading the graph data

The Download Data option allows you to get a copy of the data that has produced the current graph. It is a tab-separated file suitable for import into a spreadsheet application.


The World Map provides a visual representation of users accessing your services. Every request that is sent to a virtual server shows up on the map, colored according to which of your traffic manager locations it was sent.


Many of the features on this page only available if your license has advanced analytics enabled. If you do not have this license option you will only be able to use the features listed in the Basic Mode section.

This page allows you to monitor the connections and individual requests being handled by the traffic manager.

Basic Mode

The basic connections page displays the latest connections that your cluster has received in date order (most recent first). The page displays a snapshot of connections from a point in time, where all connections after that time will not be displayed until the Refresh Snapshot button is pressed.

You can show and hide field columns using the plus button in the top left of the connections table. This displays a dropdown list of fields that the table is currently displaying. Clicking on each field in this list toggles it from being displayed.

A simple filter can be applied to the displayed data, to only show connections to a specific node (the 'To' column). This is a single-field version of the filter functionality available in the Full Mode. Please refer to the usage instructions described below.

You can also download the currently displayed data as a tab separated value file (TSV) using the Download button. This will contain every available field, not just the ones you are currently displaying on the page.

The basic mode displays the following fields (a description of each of these fields is provided in the Full Mode -> Fields section): Time, Traffic Manager, From, Via , To, State, Virtual Server, Rule, Pool, SLM, Request Bandwidth Class, Response Bandwidth Class, Bytes In, Bytes Out, Response Code and Request.

Full Mode

In full mode the connections page allows you to filter and sort the connections displayed. This allows you to track specific types of connections that you are interested in, which can be useful when trying to troubleshoot problems with your back-end servers. You can also view individual connections in greater detail by viewing the connection's detail page.

Filters

Filters can be applied to the displayed data, only displaying connections you are interested in, through one of two methods:

As an example, to show all requests that generated a 404 response you can select 'Response Code' from the Add Filter drop-down list, select 'equals' from the comparator drop-down, and enter '404' into the text box. After clicking 'Update Filter', only the requests that received a 404 in response will be shown in the table.

Alternatively, if you click a property of a specific connection or request you can add a filter that matches all connections and requests with that property. For example, clicking the virtual server name for a recent request will show an Add Filter pop-up that you can provide to directly filter connections and requests received by that virtual server.

The current set of filters being applied is shown above the connections table. From here you can remove filters, refresh the table to include connections that have been established since the page was loaded, and download the filtered data as tab-separated values.

Fields

Like in basic mode, you can hide fields so that the connections table displays only the fields you are interested in using the plus button at the top left of the table. Full mode has many additional fields not displayed when using basic mode. See the list below for details on each field.

You can sort the current connections and recent requests by clicking a heading in the table. Clicking on the heading again will reverse the sort. A small arrow next to the heading in question denotes the current direction of sort.

Viewing Connection Details

You can view details of active connections and recently completed requests by clicking the magnifying glass icon to the left of the relevant entry in the table. This will take you to the Connection Details page.


This page shows detailed information about a particular active or recently completed connection. This information includes request and response headers (including any changes made by rules) and, if tracing is enabled, a timeline showing the different phases of request processing.

The request and response details sections are only available for HTTP, SIP and DNS traffic.

Connection Summary

This section shows the connection properties in detail. See below for a description of each property.

Request Tracing

This section gives you a timeline of internal connection processing events. This can be used to determine how long each stage in processing a connection took, allowing you to identify slow rules or problimatic client/server behaviour. In order to use this feature, you must first enable Request Tracing on the Virtual Servers > Edit > Request Tracing page.

Aptimizer Request Tracing

This section shows the timeline of connection processing events performed by the Aptimizer process. It has the same format as the traffic manager request tracing described above, but the timings start when the Aptimizer process is notified of an incoming request that is a candidate for optimization.

The Aptimizer process communicates with the traffic manager process using an IPC (inter-process communication) channel. Details of communication over this channel are recorded in the request trace.

The Aptimizer Request Tracing section will be shown only if both Aptimizer and Request Tracing are enabled on the virtual server.

Request Details

This section shows you detailed information on the request that the client made. For HTTP this will be the headers of the HTTP request.

Response Details

This section shows you detailed information on the response that the traffic manager sent to the client. For HTTP this will be the HTTP response code and headers.

Aptimizer Analysis

This section shows details of the optimizations performed by Aptimizer on the requested resource. The same information is embedded at the top of an optimized page if the Aptimizer info bar is enabled.

The Aptimizer Analysis section will be shown only if Aptimizer is enabled on the virtual server, and the info bar is enabled on the Aptimizer profile selected for this request.


This page shows the list of currently draining nodes in your configuration, the number of remaining active connections to them, and the last time a connection was made.

The node is free to be taken down without disrupting traffic if there are no active connections left.

The Content Cache activity page summarises how the traffic manager's content cache is currently being used.

At the top of the page is a summary showing what proportion of the cache is currently in use. This information is broken down into the amount of physical memory being used (the maximum as determined by the webcache!size setting, available on the Global Settings page) and the total number of cache entries that have been stored (with the upper limit defined by the webcache!max_file_num setting). When either of these limits are reached, the oldest entries in the cache will be removed to create room for new ones.

The number of cache hits, lookups and the relative success of attempts to serve requests from the cache are also shown in the summary.

Below the summary section is a table containing specific information about all the resources that are currently stored in the cache:

Vars
Each cache entry has one or more variants. A variant is a version of the resource that is applicable to a specific set of clients that might request it. Typically a response will contain a Vary header that describes the criteria other clients must fulfil for that response to be valid. For example, if a response is compressed then a client only that sends the appropriate Accept-Encoding header can be given the data.

By clicking the Vars number for a given cache entry, you can see for which clients the resource is valid, along with the expiry time, last used time, number of hits, and the size of that specific version of the resource.

Status
The HTTP status code returned by the server.
Expires in
The time until the resource expires from the cache and is removed. If there are multiple variants, this is the time until all the variants have expired.
Last used
How long ago this cache entry was last accessed. If there are multiple variants, this will show the most recently accessed variant.
Size
The size (in bytes, unless a unit is specified inline) of the cache entry. If there are multiple variants, this shows the total size of all the variants.
Hits
The total number of times the resource has been served to a client from the web cache. If there are multiple variants, this shows the total number of times any variant has been served.
URL
The URL of the resource stored in the cache. If the variants section is expanded, this column will show for which clients each variant is valid.

If Aptimizer is available, an option is present in the Display Cache Items section to show resources that have been optimized. When selected, the following additional columns will be shown in the table:

Optimized
Whether or not the resource in the cache has been optimized by Aptimizer. Some optimized resources will be placed in the cache automatically by Aptimizer irrespective of whether the virtual server has caching enabled.
Dependent
Whether or not the resource in the cache was fetched by Aptimizer as part of the optimization process. When Aptimizer is optimizing an HTML page, for example, it will request some of the images, stylesheets, and javascript files referenced by the page to optimize them. If the virtual server cache is enabled, these resources will be cached where possible and will be marked as dependents in the cache activity table.

Even though caching is enabled for the virtual server and connections pass through Stingray, the content cache may still remain empty. The reason is that some requests and responses are not cacheable. You can turn on the 'webcache!verbose' flag in System ->Global Settings. This makes Stingray add a special X-Cache-Info header to every HTTP response. The header value will show if the request or response was uncacheable.
Note also that even if caching is disabled for a virtual server, if it uses Aptimizer then some resources will be automatically placed in the cache. This is necessary for Aptimizer to function efficiently. In this situation, Aptimizer will cache only what is essential to its functionality; HTML pages, for example, will not be cached unless the virtual server has caching enabled.

Options

The options provided enable you to restrict the properties of cache items to display:

If you leave the host and path fields empty, 'no-restriction' or 'match-all' semantics are implied. Finally, you can choose how many URLs to present. Note, however, that you cannot see more than 500 at a time. This limitation has been put into place to avoid too much load and network traffic since the cache can contain millions of items in large installations. If more items match the wild-cards than can be displayed, the total number of matching items is shown as well. In this case, you might wish to restrict the selection criteria further before deleting the items.

To clear out the individual items of the content cache, tick the box next to the items and press the Clear Selected button.

To remove all matching items from the cache, click the Clear All N Items button, where N is the number of matching items.

A note on query strings: Variables can be passed to applications in the conventional manner: app.jsp?a=1&c=0&b=3. Applications do not care about the order in which variables are passed, so the above example is equivalent to the following string: app.jsp?a=1&b=3&c=0. It would be a waste of memory to cache the response twice and therefore Stingray caches it only once. To ensure that all requests differing only in the order of the variables hit the same cache entry, Stingray normalizes the query string, i.e. it brings the variable-assignments into alphabetical order. Therefore, to display or remove a particular page with variables, you don't have to search for all possible combinations, but only have to specify the page once — with the sub-strings sorted. In the unlikely case that an application or framework does depend on the order of the variable assignments, the normalization can be disabled in System –› Global Settings –› Cache Settings (config key webcache!normalize_query).

Examples

Host header

Assume you are serving the addresses www.all-included.com, www.all-excluded.com, www.all-reduced.com, and www.give-away.com. If you only want to see pages cached for site www.give-away.com, you would enter the text 'www.give-away.com' in the host field (without the apostrophes) and leave the path field empty, choosing 'http and https' for the protocol choice. If the give-away site serves pages below a /all-you-can-eat/ and a /keeping-your-balance/ directory, and you only want to see the pages below /keeping-your-balance/, you would additionally enter '/keeping-your-balance/*' in the path field. If you want to be even more specific and only wish to display information about all files or directories below /keeping-your-balance/ that start with the word fat-free, you would enter '/keeping-your-balance/fat-free*' in the path field.

Path

If you want to see cached pages from either the all-included or the all-excluded domains, but not from your other hosted domains, you can specify the host field as 'all-*cluded.com' or as 'all-??cluded.com'. If you were to set it to 'all-*.com' or 'all-*ed.com', entries from the all-reduced.com site would be shown as well.

Port specification

In the examples given in the previous sections the default ports were used (80 for http and 443 for https), so the port number was not specified explicitly. If you were to specify it, for example by entering 'www.give-away.com:80' in the host field, the pages would not match, i.e., for the default ports you must not include the port number in the host field. If another virtual server was running on port 8000, and you only wanted to match that server's cached pages, you would have to enter 'www.give-away.com:8000'. To see pages for both servers, you could specify 'www.give-away.com*'

What can be cached?

Not all web content can be cached. The following conditions are a guide to what can and cannot be cached by Stingray. If you require more fine-grained control over the cache, then you can use TrafficScript rules to control which parts of your site are cacheable.

For more details about HTTP web caching, please see the HTTP 1.1 specifications in RFC 2616.


Virtual Server Logs

This page allows you to select and view virtual server request logs. A separate entry is shown for each virtual server, and indications are given for whether or not request logging is enabled.

If logging is enabled, clicking on the virtual server name takes you to the log viewer page. You can also simply view the current logging settings by unfolding the section under each virtual server heading.

If logging is disabled, clicking on the virtual server name takes you to the request logging settings page. You can enable logging from there.


Request Logs for a virtual server

This page displays requests in real-time and updates automatically. This updating can be stopped and restarted by clicking the link at the top of the page.

The logs are presented in the format specified on the request logging settings page for this virtual server, so can be quite verbose depending on the log format used. The most recent requests are presented at the top of the page.


This page lists the saved request logs for your virtual servers (and GLB services where Global Load Balancing is enabled) ready for downloading. The logs are separated into three main sections: Current, Archived, and Defunct. You can alter the services and time span used via the controls at the top.

Please note that only the logs stored on the local traffic manager are shown. To view the logs stored on another traffic manager in the cluster, please log in to its Administration UI.

Current

Log files in the current section are theoretically 'in use'. However, if there is no traffic going to a particular virtual server then the corresponding access log will not be written to. Either way it is perfectly safe to download this file for inspection, but be aware that dates and file sizes may be out-of-date by the time you hit the download button.

Archived

These files have been archived (gzipped). Log rotation policy is different depending on whether you have a Stingray Appliance or a software-only version of Stingray:

Stingray Appliance:

On an appliance the log file naming and rotation is handled automatically:

Once the log directory reaches 85% of capacity the Stingray software will start to delete the oldest files from the most full directories.

Defunct

When a virtual server is deleted its corresponding log files are not deleted. Log files left-over from a virtual server that has been deleted are considered to be 'defunct' and displayed in this section.

If you delete a virtual server and then create another with an identical name the previous virtual server's log files will become associated with the new virtual server and be removed from the 'defunct' section into the archived section.

Where are my log files kept?

The Stingray Appliance stores all its log files in /logs/vservers separated into sub-directories for each virtual server. Eg:

 /log/vservers -+-> Foo ---> Foo.log
                |            Foo.log.20061121.1.gz
                |            Foo.log.20061121.2.gz
                |            :
                |
                +-> Bar ---> Bar.log
                |            Bar.log.20061121.1.gz
                :            Bar.log.20061121.2.gz
                             :

This page lists the traffic managers in your cluster. Initially, you will only have one, but you can add additional traffic managers for fault tolerance, performance or operational reasons.

Details of each traffic manager in the cluster are shown, including the software version, license key, and administration server location.

Multi-site cluster management

Stingray's multi-site cluster management feature allows you to manage multiple clusters of traffic managers, each with its own configuration, by assigning each traffic manager to a location. Locations are configured from the Catalogs > Locations page.

Multi-site cluster management can be disabled or re-enabled here. You will need to disable multi-site cluster management here before using the Stingray Application Firewall.

Note: Disabling multi-site cluster management will remove existing configuration locations and all location-specific configuration values.

EC2 Instance Settings

When starting an EC2 instance you can provide it with a 'user data' field that allows the instance to perform certain actions as it starts up. By providing the user data specified in this section you can start a new instance with the same default settings as this instance or you can instruct the new instance to join this instance's cluster.

Managing a Traffic Manager

This section contains system information to help manage your local machine.

Note that this section can only manage the traffic manager that you are currently logged into. Use the links on this page to access the UI of the other traffic managers to manage them.

Software Upgrade

The current version of the software is shown in the Traffic Managers section above. You can upgrade the traffic manager or other software on the admin server by clicking on the 'Upgrade' button. You will then be able to upload a new package. You can also use the Software Upgrade section to install new modules, such as the Stingray Application Firewall.

Software Upgrade

The current version of the software is shown in the Traffic Managers section above. You can upgrade the traffic manager or other software on the admin server by clicking on the 'Upgrade' button. You will then be able to upload a new package. You can also use the Software Upgrade section to install new modules, such as the Stingray Application Firewall.

Software Restart

Restart Software
This button will restart the Stingray software running on this machine. You will be asked to confirm this action.

If you restart your Stingray software all current connections to this machine will be lost

Restart Stingray Application Firewall
If you have the Stingray Application Firewall installed, this button will restart the Stingray Application Firewall software. You will be asked to confirm this action.

Hardware Restart

Shutdown
This button will shutdown this traffic manager. You will be asked to confirm this action.
Stop
This button allows you to stop the Stingray instance. You will be asked to confirm this action.

When you stop an EC2 instance, the instance will be shutdown and the virtual machine that was provisioned for you will be permanently taken away and you will no longer be charged for instance usage. The key difference between stopping and terminating an instance is that the attached bootable EBS volume will not be deleted. The data on your EBS volume will remain after stopping while all information on the local (ephemeral) hard drive will be lost as usual. The volume will continue to persist in its availability zone. Standard charges for EBS volumes will apply. Therefore, you should only stop an instance if you plan to start it again within a reasonable timeframe. Otherwise, you might want to terminate an instance instead of stopping it for cost saving purposes. To Terminate an instance please use the EC2 console.

Reboot
This button will reboot this traffic manager. You will be asked to confirm this action.

If you shutdown or reboot your traffic manager, all current connections to this machine will be lost

Machine Uptime

The uptime shows how long the system has been running without a reboot.

Disk Usage

The disk usage section displays the amount of disk space available on the on all currently mounted file systems.

Replace Traffic Manager Name

In general the hostname is used as traffic manager name. If the traffic manager name is unresolvable this creates a problem while clustering. To avoid this problem the name can be changed to an IP address from the given list. If None is selected, the hostname will be used.

Adding a Traffic Manager

To add a new traffic manager to the cluster, log in to the machine to be added and run the Join a cluster wizard.

Removing a Traffic Manager

Before removing a traffic manager from the cluster you should first ensure that your external connectivity will not be compromised. To remove a traffic manager, select the machine to remove and press the Remove Selected button. This will bring up a confirmation page.


Remove a traffic manager

You have two options when removing a traffic manager:

  1. Completely remove all configuration from the traffic manager and remove it from the cluster. This will stop the remote traffic manager, and you will need to run the ZEUSHOME/zxtm/configure script before you can use it again.

  2. Just remove the traffic manager from the cluster. This will leave the traffic manager still managing traffic, but it will no longer be part of the cluster. This may cause problems with the fault-tolerant IP address support if the machine is a member of a traffic IP group, so should be used with care.

    If the traffic manager has Stingray Application Firewall installed on it then removing it from the cluster will result in the Stingray Application Firewall Administration Server username and password both being reset to 'admin'.

Forcibly removing a traffic manager

If the removal fails, you can delete the machine forcibly from the cluster. This should be used with care as the remote traffic manager will still assume it is part of the cluster. It is useful when a machine has failed permanently. Before starting the Stingray software on the machine, you should first re-run the ZEUSHOME/zxtm/configure script to reset its configuration.

If the remote traffic manager had Stingray Application Firewall installed then you should uninstall it as soon as possible. Running an instance of Stingray Application Firewall that has not been properly removed from a cluster can interfere with the remaining members of the cluster.


Stingray may restart after an upgrade. If this happens, all live connections will be lost.

Stingray can be upgraded from the user interface by uploading new software packages to the admin server, from your web browser. The upgrade is a three step process:

  1. Use your web browser to upload the upgrade package.
  2. You will then be shown the details of the upgrade package that you have chosen. This includes information such as the name of the upgrade, the version number, a description of the program and the reason for the upgrade (e.g. a security fix). Also shown is a unique MD5 value that has been calculated from the data within the package. By checking this value against that shown on the original download page you can confirm the integrity of the package. If the MD5 numbers are the identical you can be confident to an acceptable extent that the package is identical to the one originally downloaded.

    An upgrade is by its very nature an installation of new software. Any new software may provide new (or different) behavior compared to that on which you have come to rely. While we will ensure that all upgrades provide minimal disruption, it is vital that you read all relevant documentation before proceeding to ensure that any behavior you rely on will not be altered without your knowledge.

  3. If you are happy to proceed with the install, click on the confirmation button and the upgrade will take place. Please be patient as the upgrade installs.

If you are upgrading the Stingray software (as opposed to operating system software: e.g ssh), then the admin web interface will need to be restarted as part of the upgrade process. This is performed automatically once the upgrade has completed.

You may also need to reboot your machine to complete the upgrade. In this case, your traffic manager will continue to run using the old version until the reboot. If you have other traffic managers in a cluster with the upgraded machine, you should upgrade them as well before the reboot. If you reboot without upgrading the other machines your cluster will contain traffic managers of different versions and configuration information will not be distributed between them. The cluster will begin distributing this information again once all the traffic managers are running the same version of the software.

Stingray may restart after an upgrade. If this happens, all live connections will be lost.

Stingray can be upgraded from the user interface by uploading new software packages to the admin server, from your web browser. The upgrade is a three step process:

  1. Use your web browser to upload the upgrade package.
  2. You will then be shown the details of the upgrade package that you have chosen. This includes information such as the name of the upgrade, the version number, a description of the program and the reason for the upgrade (e.g. a security fix). Also shown is a unique MD5 value that has been calculated from the data within the package. By checking this value against that shown on the original download page you can confirm the integrity of the package. If the MD5 numbers are the identical you can be confident to an acceptable extent that the package is identical to the one originally downloaded.

    An upgrade is by its very nature an installation of new software. Any new software may provide new (or different) behavior compared to that on which you have come to rely. While we will ensure that all upgrades provide minimal disruption, it is vital that you read all relevant documentation before proceeding to ensure that any behavior you rely on will not be altered without your knowledge.

  3. If you are happy to proceed with the install, click on the confirmation button and the upgrade will take place. Please be patient as the upgrade installs.

If you are upgrading the Stingray software (as opposed to operating system software: e.g ssh), then the admin web interface will need to be restarted as part of the upgrade process. This is performed automatically once the upgrade has completed.

You may also need to reboot your machine to complete the upgrade. In this case, your traffic manager will continue to run using the old version until the reboot. If you have other traffic managers in a cluster with the upgraded machine, you should upgrade them as well before the reboot. If you reboot without upgrading the other machines your cluster will contain traffic managers of different versions and configuration information will not be distributed between them. The cluster will begin distributing this information again once all the traffic managers are running the same version of the software.

EC2 instances should be upgraded by replacing them with new instances. A cluster can be migrated one instance at a time by adding a new instance, terminating an old one, and repeating. For more details, see the Installation and Getting Started Guide For Stingray on Amazon EC2.


This page allows you to install, remove or configure the Stingray Application Firewall. From here you can modify the ports that it uses, specify how many processes it should run, and join a cluster of other machines running Stingray Application Firewall

Note that any changes you make to the Stingray Application Firewall settings here will apply to every machine in the cluster that is running Stingray Application Firewall.
Updating the settings on this page will result in Stingray Application Firewall being restarted on every machine in the cluster on which it is installed.

Stingray Application Firewall Control

This section allows you to enable or disable the Stingray Application Firewall on all machines in the cluster

Stingray Application Firewall Decider Settings

This section allows you to configure the Stingray Application Firewall decider processes that run on every machine in the cluster that has Stingray Application Firewall installed.

The Stingray Application Firewall decider processes are responsible for determining whether a particular request should be allowed through the firewall or not, depending upon the firewall settings you have configured.

Decider Processes

This setting allows you to configure the number of Stingray Application Firewall decider processes. It is recommended that you set the number of decider processes to be the same as the number of CPU cores available on the machine with the fewest CPU cores in the traffic manager cluster. For example, if you have two machines in your cluster, one with four CPU cores and one with two CPU cores, you should set the number of decider processes to '2'.

Depending on how much processing the traffic manager and firewall are performing you might be able to increase the overall performance of the system by reducing the number of decider processes that Stingray Application Firewall uses.

Note that this setting applies to every machine in the traffic manager cluster - every instance of Stingray Application Firewall will run with the same number of decider processes.

Decider Port

This setting controls which ports the Stingray Application Firewall decider processes will use. The port number specified by this setting will be used to distribute requests between the decider processes. The decider processes themselves will listen on ports sequentially above this port.

As an example, consider the Decider Port being set to 8100 and the number of Decider Processes being set to 2. Three ports will be used by Stingray Application Firewall - port 8100 for distributing requests between the two decider processes and ports 8101 and 8102 for the decider processes themselves.

Stingray Application Firewall Ports

Stingray Application Firewall uses several additional ports for internal communication and for communication between different cluster members. This section allows you to configure which additional ports Stingray Application Firewall uses.

Admin Server Port

This setting controls which port the Stingray Application Firewall will use for administration. It is only open for connections on localhost.

Note that changing this setting will restart the Stingray administration server on every machine in the traffic manager cluster. This will terminate all active administration sessions.

XML Master Port and XML Slave Port

These two ports are used for communication between the cluster. Stingray Application Firewall listens for requests made to these ports on all IP addresses.

Updater External Control Center Port

This port is used for communication between Stingray Application Firewall and the Updater process. You only need to change this port number if it is already used by another process on your system; it is automatically configured by default.

Updater Slave Port

This port is where the Updater slave listens for requests on, to allow the Updater to talk to other Updaters in the cluster. You only need to change this port number if it is already used by another process on your system; it is automatically configured by default.

Updater GUI Server Port

This port is where the Updater listens for HTTP requests, which are transparently relayed through the Stingray Admin interface. You only need to change this port number if it is already used by another process on your system; it is automatically configured by default.

Note that changing this setting will restart the Stingray administration server on every machine in the traffic manager cluster. This will terminate all active administration sessions.

Updater GUI Backend Port

This port is where the Updater listens for control commands from the Updater User Interface. You only need to change this port number if it is already used by another process on your system; it is automatically configured by default.

Decider Internal Base Port

Stingray Application Firewall uses several ports for internal communication. These ports are bound only to the local machine (IP address 127.0.0.1). Stingray Application Firewall will use the port specified by this setting, and a number of free ports sequentially above that, until it has enough ports with which to operate.

Stingray Application Firewall Cluster

This section shows you the status of the machines in your Stingray Application Firewall cluster, if you are part of one. If there are any problems with the cluster you can find more information about them on the diagnose page.

If this machine is not currently part of the Stingray Application Firewall cluster then you will be provided with the option of joining the other machines in the cluster. To do so, enter the username and password of a user with Application Firewall > Administration permission.


Uninstall Stingray Application Firewall

This section allows you to uninstall Stingray Application Firewall from your system.

All Stingray Application Firewall files will be removed from the system, so it is recommended that you back up your configuration before uninstalling Stingray Application Firewall.

If this traffic manager is part of a cluster then it is recommended that you remove it from the cluster before uninstalling Stingray Application Firewall.

EC2 Networking Summary

The current network setup of this EC2 instance is shown here. It contains the current IP addresses and hostnames this machine can be contacted with. Private addresses can be used only within the same availability zone of EC2. Public addresses can be accessed externally.

VPC Networking

In EC2-VPC each EC2 instance has a default network interface that is assigned a primary private IP address on your Amazon VPC network. Additional IP addresses known as secondary private IP addresses can be assigned to Amazon EC2 instances that are running in Amazon VPC. The number of secondary private IP addresses that can be assigned varies by instance type.

This section will show primary and secondary IP addresses assigned to the default network interface of the instance. You can allocate new secondary IPs. Leave the address field blank and an available address will be assigned or enter an IP address that you want to assign. You can release the secondary IPs which have no EIP associations.

For each Traffic IP, the traffic manager will need a secondary IP without any existing EIP associations.

The traffic manager keeps a list of secondary IP addresses of default network interface of the instance in the configuration system. Any mismatch with actual secondary IPs as returned by EC2 will be raised as an error which can be resolved here.

Hostname Mappings

Enter hosts that you want to resolve without using DNS, (i.e. entries to be added to the /etc/hosts file). Changes here will not take effect until the software is restarted.

Network Configuration

Your traffic manager contains a number of network interfaces and requires a hostname to identify it. This section allows you to configure these settings along with DNS, Routing, IP forwarding and NAT.

Note that if you initially configured networking using the Initial Configuration wizard, all of the most important settings here should already be configured.

Note that, unlike most other settings in the Admin interface, any settings you configure on this page apply only to the traffic manager whose admin interface you are accessing. If you want to inspect or configure the network settings for a different traffic manager in your cluster, you should use the Admin Interface for that machine.

For more information about setting up a Stingray virtual appliance, see the Virtual Appliance Installation and Getting Started Guide

For more information about setting up Stingray, see the Getting Started Guide

For more information about setting up an appliance, see the Installation and Getting Started Guide

For more information about setting up an appliance, see the Installation and Getting Started Guide

A Typical Network Set-Up

This example is taken from the Installation and Getting Started Guide which also contains other example set-ups. It is included here to try and illustrate what the various settings on this page do.

This configuration splits the layout into public and private networks. This offers greater security, because the private network hides the internal back-end services from the outside world. Access is only permitted through the traffic manager. Using more appliance network interfaces also gives higher performance as there is greater bandwidth capacity.

The example shows the gateway and Stingray's front-end (eth1) interface being configured with publicly routable IP addresses (the xx.xx.xx network, netmask 255.255.255.0). The back-end interface (eth2) is configured to be on the internal network (10.100, netmask 255.255.0.0). Finally, the management interface is run on an entirely different network, which restricts control of the traffic manager to the secure network.

Hostname and IP addresses

Hostname
The name of the Stingray Appliance itself. If you have DNS set up for your network, you should ensure that the hostname will resolve to the Stingray management port IP address (i.e. you will have to tell your name server about this new hostname).
  • Only letters, digits and dash characters are legal in hostnames (see RFC-952)

As a hostname cannot contain reserved characters such as '!', '.', '/' or '\', we recommend short descriptive names such as Greek Gods, Cartoon Characters or Malt Whiskys.

Management port
The management port is the IP address used to administer this appliance from the web-based admin interface or by logging into the machine using SSH.

The Management Port is also used by the appliance to send and receive fault tolerance messages to other traffic managers in a cluster. It is essential that this network interface is configured and plugged in. You will be asked to enter the IP address and netmask of the management port. The broadcast address will be calculated automatically.

  • The management port is always on eth0,
  • Hence, you cannot remove eth0
  • You can, of course, change the IP address of eth0

Changing the management port to an address unreachable over your network will cause your appliance to become uncontactable. You will need to access the machine directly by attaching a monitor and keyboard to the back of it.

IP Addresses
  • Each interface can have multiple IP addresses.
  • You cannot delete the management interface, but you can reconfigure it
  • If you configure a network interface that does not have physical connectivity, Stingray will display an error.
  • If you configure the same IP address on multiple physical interfaces, Stingray will make the interfaces members of a trunk. For this to work, your switch must support IEEE 802.3ad, and may need to be reconfigured to enable it. Your switch may refer to this feature as link aggregation, bonding or trunking.
MTU
For each network interface you can configure the maximum transimission unit. This defines the largest amount of data that can be sent in a single packet.

Where are my network ports?

The number and layout of ethernet ports varies depending on which appliance you have.

For more information about setting up an appliance, see the Appliance Quick Start Guide

Ethernet speeds

Normally, network cards will auto-negotiate to the best available speed and these settings will not require adjustment, but you can manually force a speed here if needed.

  • You cannot manually set a 1Gbit speed as the 802.3ab standard doesn't allow it (it must be auto-negotiated).

If this section displays incorrect settings that you have to change manually it may indicate that you have a faulty switch.

Virtual LANs

This section allows you to create Virtual LAN interfaces on top of existing physical interfaces and bonded/trunked interfaces. Virtual LANs (or VLANs) are defined by IEEE 802.1Q, and allow a tag to be set in the ethernet packet header, which ensures that only the devices on that specific VLAN can see packets sent to or from it.

VLANs are identified by a tag number between 1 and 4094, with which you create a mapping to the network interface selected. Once created, mappings can easily be removed by selecting the adjacent "Remove" checkbox and clicking Apply. Multiple VLANs can be set up on one physical network interface.

Interface
  • This specifies which physical interface you would like to be used for this new Virtual LAN interface that you are creating.
VLAN ID
  • This specifies the VLAN tag identifier to be used with this new Virtual LAN interface you are creating. This should be specified as an integer between 1 and 4094.

DNS

This section allows you to set the DNS servers for this traffic manager. Manual DNS entries can be added for specific hosts.

Name Servers
  • This is an ordered list of IP addresses of the name servers that the Stingray Appliance should use for DNS resolution. The servers at the top are contacted first; the order can be changed with the up and down arrows. If you do not use DNS, you can just skip this.
Search Domain
  • The domain(s) that should be appended to unqualified host names when trying to resolve them. This defaults to the domain name as configured above. A list of search domains can be used if desired. This is an ordered list; the domains at the top are searched first. The order can be changed with the up and down arrows.
Fixed Host→IP mappings
  • Hosts that you wish to resolve without using DNS, (i.e. entries to be added to the /etc/hosts file). Changes here will not take effect until the software is restarted.

Routing

Default gateway
The IP address of the default gateway to which the appliance can forward non-local network traffic.

This IP address is also used for network connectivity tests by Stingray. Your gateway machine should respond to ping requests by Stingray. If it does not, then Stingray will need to be configured with an alternate machine to ping instead. The install process will test this for you. If you need to configure a different address to ping, this can be set up through the web-based traffic manager interface later.

Adding a route

For complex network configurations, extra routes and gateways can be added here.

Specifying a Gateway is optional:
  • If no gateway is entered, traffic will be sent to the specified interface.
  • If a gateway is specified, traffic will be sent to it instead (therefore there must already be a route to this gateway).

Return Path Routing

This feature is used to force packets sent back to a client to go via the same router as the last hop the connection setup packet arrived from.

Return path routing mappings override the standard routing table for traffic that matches the provided rules. Unmatched traffic will be sent using the standard routing table (configured in the routing section of this page). Active mode FTP data connections are treated as return path traffic so long as the FTP virtual server is hosted on the standard port

There is a performance impact from connection tracking, so this feature should be disabled if not required on your network setup.

MAC address

This is the address of the physical or logical network interface card in one of your routers. It is used so the appliance can determine which router a connection arrived from.

Your router configuration interface might display this information. Alternatively, use network tools such as "ping", "arp" and "tcpdump"

IP address

This is the IP address of the router matching the MAC address that was entered. It is used as the first hop of return path traffic. For each MAC address, you can have one IPv4 address and one IPv6 address.

If your router has multiple IP addresses, choose one that is on the same subnet as a static IP address of the Stingray appliance.

If an incorrect IP address is entered, traffic may be dropped.

Using Return path routing with Traffic IP networks

Because of the way Return path routing is implemented, the Stingray appliance needs to have a static IP address in the same subnet as each router it should forward return packets to. A traffic IP is not sufficient because it may be raised and lowered dynamically.

The static IP does not need to be allocated from the Traffic IP network, any IP address which is in a subnet shared with the router is sufficient.

In a flat network, the Appliance's primary IP address is normally sufficient for this purpose. However if you had intended to only raise traffic IPs on the front end network, then one way to achieve this is to create a private address range and allocate each traffic manager and router an address in that range.

NAT / IP Forwarding

Here you can enable forwarding of IPv4 traffic so that the Traffic Manager can act as a gateway. The option is not available if you have any IP forwarding NAT rules defined on the NAT page, since they enable IP Forwarding.

You can set NAT rules for traffic moving through the Traffic Manager using the NAT page. The types of NAT rule are "IP Mapping", or outbound rules, and "Port Mapping", or inbound rules. These are both configurable and explained in detail on the "NAT Rules" page.


NAT will translate IP addresses between two networks (e.g. between private/internal and public/external networks). All rules added using this interface require a Traffic IP Group. If you do not have a Traffic IP Group configured, you can add one in "Services > Traffic IP Groups".

IP Mapping Rules

There are three types of NAT rule which you can enter using this form. You cannot apply multiple rules at once.

One to One. Connections initiated by a specified IP address are NAT-translated and leave via a particular TIP address. If "Add Inbound" is ticked, traffic addressed to that TIP group will be forwarded to the specified IP address, making a One to One rule bidirectional.

The inbound part of One to One rules are carried out before packets reach a Virtual Server. If traffic arrives on a TIP Group a Virtual Server is listening on, and that TIP Group has a One to One rule defined, the rule will be carried out before the Virtual Server receives the traffic.

Many to One: Port Locked. Each connection initiated by members of a specified pool are NAT-translated and leave via a particular TIP address. Each protocol has its own rule. The valid protocols for this feature are: 'icmp', 'sctp', 'tcp', 'udp' and 'udplite'. The destination port for the connections is also required.

Many to One: All Ports. All remaining connections attempted by members of the specifed pool are NAT-translated and leave via the specified TIP address. A protocol and port is no longer required as this applies to all connection types on all ports not otherwise specified.

If your traffic manager does not have any pools configured, you will not be able to use the many-to-one rules.

Port Mapping Rules

Virtual Server Port Forwarding. These rules allow a Virtual Server to listen on a range of ports, rather than just one. This is done by forwarding all traffic coming in through the specified ports to the Virtual Server's port. You can create several rules for one Virtual Server. If you want to forward just one extra port to the Virtual Server, enter the same port number for both the upper and lower bound of the range.

Like the one-to-one rules, these rules are also carried out before packets reach a Virtual Server. Therefore, even if the target port of a connection is a port which a Virtual Server is specifically listening on, if a Port Mapping rule has been applied to that port the traffic will be redirected (possibly to a different Virtual Server) without the original Virtual Server seeing it.

Existing Rules

You can also review and delete any rules previously entered using this page. Each section has its own list of existing rules, which behave in the same way. The ordering of the rules does not reflect the order in which they are applied as that is determined by the Traffic Manager. To update an old rule, delete it from the current configuration and then re-add the new rule.

To delete rules added using this interface, tick the box next to a rule and then click "Delete selected rules". It will be removed from both the Traffic Manager configuration and local NAT table. Multiple rules can be deleted at once.

If a rule appears to be greyed out, it is not currently being used. This is because either

is no longer available. The attribute that is now unavailable will be shown in bold. Note that if you do not delete the rules which refer to old configuration attributes and you then add an interface, TIP group or pool with the same name as the old attribute, these rules will be applied to the new system configuration. If you do not expect to re-add the unavailable attribute you should delete the rules associated with them.

Default Rules on Interfaces

Select which interfaces should perform NAT on network traffic that is forwarded on behalf of an internal source. Typically, these interfaces will have publicly routable IP addresses, and will be located on the external side of your network (for outgoing traffic). Any traffic that is forwarded out of this interface is NAT'ed: the source IP address in the traffic is replaced with the IP address of the gateway interface (the source port number may also be replaced with an arbitrary port number).

From the destination node's perspective, the traffic appears to originate from the traffic manager's gateway IP address. The destination node (and all intermediate hops) should know how to route traffic back to that IP address. When the destination node replies, Stingray receives the reply on the NAT interface. It inserts the original source IP address and port into the reply and forwards it on to the back-end node that originated the connection.

If you are running with only one interface (e.g. eth0) be sure to disable the management port otherwise NAT will not work as expected.


This allows you to modify kernel parameters through the sysctl interface. You can also view and delete any of the parameters you have previously altered.

You should not modify these parameters unless directly advised to do so by Riverbed.

General Notes

Sysctl is an interface to change kernel parameters while the system is still running. Some parameters are controlled by the traffic manager and are generated from other settings you have applied. Attempting to change these values will result in the traffic manager not functioning correctly. You will be told through an error message if you attempt to modify one of these parameters, and your change will not be applied.

New Entry

This interface allows you to add or change one of the kernel parameters. The name of the parameter should be entered in the "key" section, and the value(s) you wish to assign to it should be entered in the "value" section. When a parameter can be set to multiple values, separate each value with a single space. If you have already custom-defined a parameter, entering it again with a new value will overwrite the old value, and the change will replace the entry in the "Existing Entries" section. The new parameter will take effect immediately.

You can also enter a small description of your alteration for future reference. This note will be attached to the parameter listing in the "Existing Entries" section. You are encouraged to justify each sysctl entry you make to assist future additions and to help repair the system if it becomes corrupted.

Existing Entries

Here all the kernel parameters altered by the sysctl interface are listed. If a description was entered with a change, an "Info" tag will appear alongside it, and it can be viewed by hovering the mouse-pointer over this tag.

If you want to undo a change you have made, you can delete the new entry by ticking the box next to it and clicking "Delete selected entries". You may delete multiple entries at once. Once you have done this you will need to reboot your server to restore the default values. When the traffic manager comes back online the default kernel parameters for your deleted entries will have been restored.

If there is a problem with any custom defined parameters, an error will display on the Cluster Diagnosis page and the relevant entries will be highlighted here in red. Such errors can occur when a change to the system results in previously altered kernel parameters becoming unavailable. You must delete the incorrect entries before making any further modifications or additions to the sysctls. If the error was instead caused by a typographical mistake, you can then re-add the entry using the interface. If you have modified a sysctl manually from a terminal which you previously set using the UI, the conflicting value will be highlighted in yellow. The warning displayed in the Cluster Diagnosis page will offer you the option to reapply the value set using this interface, or direct you here so you can delete or update the stored value.


Stingray includes a sophisticated event handling and alerting capability. This page provides a tool to allow administrators to configure precisely what actions Stingray should take if particular events occur.

Alert Mappings

Events and action mappings are set up in this section, i.e. when a specified event occurs, Stingray runs the associated action(s). You can have multiple actions mapped to a single event, and actions can be used by several events at once.

Stingray contains one built-in "All events" mapping that causes all events to be written to the global Event Log. This built-in mapping may not be modified or deleted, although it is permitted to add additional actions to be performed.

Adding a new alert mapping

New alert mappings can be added by selecting an event type from the drop-down list. This list is populated by a combination of built-in default events and user-defined events. See managing event types for more details. A new mapping is appended to the bottom of the table, with your selected event type on the left. The arrow indicates the link to the action to be taken, yet at this point we still haven't actually selected one. Now choose an action from the drop-down list. Again, this list is populated by a combination of built-in default actions and user-defined actions. See managing actions for more details.

Modifying and deleting alert mappings

You can remove an individual action by clicking the icon to it's right. You can remove the entire alert mapping by clicking the same icon to the right of the event type.

Note that no changes are made to mappings until you click Update in the Apply Changes section. A red 'modified' notification will be displayed when changes have yet to be saved.

This page contains a catalog of the alerting actions available, both pre-defined and user-defined.

Stingray includes four pre-defined actions - an email action, an SNMP Notify or Trap action, a file logging action called "Log to file", and a Syslog action (used to write a log line in the system log).

An additional "Bypass Stingray event log" action is included in the 'Action' drop down in the alert mapping of the main Alerting page. This is a special action, not listed on this page, which will stop writing events to main Stingray error log. Log intensive events (like "Connection Failures") can use this action to avoid cluttering the main Stingray error log.

Note that this action is not available for the "All Events" event type, and that an additional alternative action is required when this is used.

Note that on a new install of Stingray, these actions are not completely configured (you will need to edit them to specify the email and SNMP settings), however when Stingray is upgraded from an earlier version, the email and SNMP settings are imported from the earlier version. These actions can be deleted - yet are easily re-created by adding a new action of type E-Mail, SNMP Notify or Trap, or 'Log to file' as appropriate.

You should ensure that your email alerts do not go via the machines in your traffic-managed system: in case of a serious failure, the messages will not get through.

You can view a simple summary of the action settings by unfolding the section under each action heading. Clicking on the action will take you to the edit page where you can modify the individual settings.

Creating a new action

In this section you can add a new action by specifying the name and type.

Action types are as follows:


Basic Settings

Core settings such as action name can be changed here. Other settings may be present such as timeout depending on the action type.

See the Managing Actions page for details of the various action types available.

Additional settings — for an SNMP Trap action

An action of this type sends an SNMP Notify or Trap, describing the triggering event, to an SNMP notification receiver application on the host you specify.

The Notify or Trap to be sent is configured using the following settings:

traphost

The hostname or IPv4 address, and optional port number, of the notification receiver application to which you want the traffic manager to send traps for this action.

You can specify a hostname or an IPv4 address, optionally followed by a colon and a port number. If a hostname is given, it must resolve to an IPv4 address. If you do not specify a port, the default of 162 will be used. IPv6 addresses are not currently supported

snmp!version

The SNMP version to use to send the Trap/Notify.

community

If the SNMP version is SNMPv1 or SNMPv2c, the traffic manager includes this community string in the Trap/Notify.

snmp!username

If the SNMP version is SNMPv3, the the traffic manager uses this SNMPv3 username.

snmp!hash_alg

If the SNMP version is SNMPv3, the hash algorithm for SNMPv3 authentication.

If snmp!auth_password is empty, this hash algorithm is not used.

snmp!auth_password

If the SNMP version is SNMPv3, the authentication password.

If you set this to empty, authentication and privacy are not used.

Otherwise, the traffic manager cryptographically signs notifications with a key derived from this password, and the signature is included in the message.

This is a shared secret: configure your SNMP notification receiver application with the same authentication password. It should then detect and reject incorrectly signed notifications. This is intended to prevent an imposter masquerading as a trusted party, as long as the password remains secret.

The password is stored in clear within the traffic manager configuration files. Only use this password for authenticating communicating with Stingray Traffic Manager (re-using the same password is not recommended security practice).

snmp!priv_password

If the SNMP version is SNMPv3, the privacy password.

If you set this to empty, privacy is not used.

Otherwise, the traffic manager encrypts the main parts of notifications, using DES with a key derived from this password.

This is a shared secret: configure your SNMP notification receiver application with the same privacy password. It should then successfully decrypt notifications. This is intended to prevent an eavesdropper from reading the content of messages, as long as the password remains secret.

The password is stored in clear within the traffic manager configuration files. Only use this password for ensuring confidentiality of communications with Stingray Traffic Manager (re-using the same password is not recommended security practice).

Most triggering events have a corresponding specific SNMP Notify or Trap type. Every such Notify or Trap is defined in the Stingray MIB, which you can download from this Edit page. Typically, you should import this MIB file into your SNMP notification receiver application.

Test Configuration

In addition to the Apply button, this page also provides an Update and Test facility with which you can immediately invoke your action. This is a useful way of testing SOAP Callbacks and Program actions.


Event Types

This page contains a catalog of the event types available, both pre-defined and user-defined. Event types currently in use are signified by a green tick next to the name.

Stingray can respond to a wide variety of events, such as node failures, Traffic IP transfers, Service Level failures and custom events raised from a rule. For convenience, individual events are grouped into a number of pre-defined types listed here. You can create new event types using the section at the bottom.


Basic Settings

You cannot modify the built-in Event Types, but you can make a copy that can be edited, or you can create new Event Types from scratch.

The individual events that Stingray can respond to are listed in the Event Tree shown in this section (for new/custom event types only). Each class of event can be unfolded to reveal the sub-classes within it by clicking on . These can, in some cases, be split down further into lower-level collections.

At the lowest level, event classes are mainly grouped into:


Each will contain a list of messages that Stingray produces when certain conditions arise. There is a checkbox next to each message. You can select this checkbox to include the message in your new Event Type.

If you wish to use ALL messages in a particular group, click Toggle Selection to select/deselect all the checkboxes.

Some event messages have a icon next to them. If you hover the mouse pointer over this icon, you can see further information regarding this message.

Each class of event involving collections of objects, such as Pools, can have events selected that apply to ALL objects, or only SOME objects in that collection. This allows a fine-grained approach to setting up Alerts that operate on the basis of events occurring to individual objects rather than every single one. For example, you can choose to be notified of the failure of a particular pool, a group of specific pools, or every pool on the system.

Custom Events

At the bottom of the Event Tree is an entry called Custom Events. This class of event can be used to trigger actions from custom situations not listed in the rest of the tree. These situations arise from use of the TrafficScript function event.emit() (or the equivalent Java function emitEvent() ).

Each time this function is used, a custom event name is supplied as an argument. You can set the Custom Events class to trigger on All custom events or Some custom events. The latter expects you to supply a list of custom event names, whereas the former simply triggers on all uses of event.emit().

Apply changes

Once you've selected all your events, click Update to save the changes.


Summary

SNMP (Simple Network Management Protocol) is a protocol for monitoring and managing network equipment.

On this page, you can configure this traffic manager's SNMP command responder. You can then use an SNMP client application, for example a Network Management Station, to send a command (such as a request for data). This traffic manager's SNMP command responder receives the command and sends back a response (such as a data value). Your SNMP client shows you the response.

In this way, the command responder enables you to query your traffic manager for many pieces of information, for example the number of current connections to the traffic manager.

Note that the SNMP settings on this page are local to each traffic manager. If you have multiple traffic managers in a cluster, remember to configure each one.

Note that data returned by a traffic manager's SNMP command responder applies only to that individual traffic manager; data is not collated for the whole cluster.

(The traffic manager can also send asynchronous SNMP notifications, also known as SNMP Traps. They are not configured here: see Managing Actions in the Alerting system.)

MIB (Management Information Base)

The data values that the traffic manager makes available via SNMP are catalogued in the MIB (Management Information Base) file. Typically, you should import this MIB file into your SNMP client application.

To view the MIB click Get SNMP MIB. To download the MIB, right-click and choose "save link as".

SNMP Settings

Specify common settings for the SNMP command responder on this traffic manager. These settings are common to all SNMP protocol versions.

snmp!enabled

Set this to Yes to turn on this traffic manager's SNMP command responder.

snmp!port

The UDP port number that the SNMP command responder service will listen on. Configure your SNMP client to send SNMP commands to this port.

Leave this value as "default" to use port 161 if possible, which is the standard port for an SNMP command responder. If the software is not running with root privileges, it is unable to use port 161, and will use port 1161 instead. Or you can specify a specific numeric UDP port.

snmp!allow

Which clients should be allowed to access the SNMP service? You may wish to restrict access to the local network or to a single administration machine. The values you can use are "localhost", which will only accept connections from 127.0.0.1, "all", which will accept connections from any IP address, and any valid CIDR IP subnet.

snmp!bindip

Which IP address should the SNMP service listen on? This setting is useful when there are multiple network interfaces on the traffic manager. You may, for instance, wish to set it to an IP address on the internal network, so that the SNMP service is not globally visible. By default the service will bind to all IP addresses available, i.e. "*".

SNMPv1 and SNMPv2c Settings

Specify the community string for accepting and responding to SNMPv1 and SNMPv2c commands.

If you set snmp!community to empty, all SNMPv1 and SNMPv2c commands will be rejected.

snmp!community

The community string required for SNMPv1 and SNMPv2c commands. The command responder rejects SNMPv1 and SNMPv2c commands that do not specify this community string.

If you set this to empty, all SNMPv1 and SNMPv2c commands will be rejected.

The community string is the equivalent of a password; it identifies authorized SNMP requests. It is not secure, as it is transmitted in the SNMP request as plain text, so you should not use a sensitive secret as the community string. The default value for many SNMP clients is "public".

If you require additional security, you can use the common SNMP settings (see above) to further restrict access. Additionally, you can disable SNMPv1 and SNMPv2c, and allow only SNMPv3 (see below).

SNMPv3 Settings

Specify the authentication and privacy settings for accepting and responding to SNMPv3 commands.

The traffic manager's SNMP command responder permits only one SNMPv3 'user'. In this section, you can configure that SNMPv3 'user account' with authentication and privacy settings corresponding to the SNMPv3 "User-based Security Model", as described in RFC 3414.

One ingredient involved in the generation of cryptographic keys from passwords is the so-called engine id. Stingray traffic manager uses a combination of the Zeus enterprise OID (7146) and the first MAC address on the machine it is running on. An example is 80001bea03001ec928bc95; the value for the traffic manager you are connected to is displayed in this section.

If you set snmp!username to empty, all SNMPv3 commands will be rejected.

Otherwise, all SNMPv3 communication is checked against these user settings, and commands whose security parameters do not exactly match are rejected. (But snmpEngineID discovery messages, which are never authenticated, and which may be sent with an empty username, are permitted and responded to).

Configure your SNMP client user account with settings that match your choices for the following traffic manager settings.

snmp!username

The SNMPv3 user's username, required for SNMPv3 commands.

If you set this to empty, all SNMPv3 commands will be rejected.

snmp!security_level

The SNMPv3 user's choice of whether to use authentication, and whether to use privacy. SNMPv3 commands must obey this choice, or they are rejected. SNMPv3 responses obey this choice.

Authentication means that commands and responses are cryptographically signed with a key derived from the snmp!auth_password, and the signature is included in the message. Incorrectly signed commands or responses are detected and rejected. This is intended to prevent an imposter masquerading as a trusted party, as long as the password remains secret.

Privacy means that parts of commands and responses are encrypted using DES with a key derived from the snmp!priv_password. This is intended to prevent an eavesdropper from reading the content of messages, as long as the password remains secret.

snmp!hash_alg

The SNMPv3 user's choice of cryptographic hash algorithm, required for SNMPv3 commands and used for responses.

Supported hash algorithms are MD5 and SHA-1. See RFC 3414 for details.

If you set snmp!security_level to "No Authentication, No Privacy", this hash algorithm is not used.

snmp!auth_password

The SNMPv3 user's password for authentication. This is a shared secret: configure your SNMP client user account with the same authentication password.

The authentication key for SNMPv3 communication is derived from this password.

If you set snmp!security_level to "No Authentication, No Privacy", this password is not used.

snmp!priv_password

The SNMPv3 user's password for privacy (message encryption). This is a shared secret: configure your SNMP client user account with the same privacy password.

The privacy key for SNMPv3 communication is derived from this password. This password should be different from the authentication password (re-using the same password is not recommended security practice).

If you set snmp!security_level to "No Authentication, No Privacy", or "Authentication only", this password is not used.


The Admin Security page lets you configure authentication and access control settings for the admin server you use to configure your traffic managers.

SSL Certificate

By default your admin server will have generated a self-signed certificate which it uses to encrypt traffic. If you want to, you can regenerate the certificate or you can supply your own. The details of the certificate that is being used will be displayed in this section.

Restricting Access

To increase the security of the admin server it is suggested that access is restricted to a known set of client machines. In this section you can define precisely which machines the admin server will accept requests from. You can enter a list of IP addresses (10.100.80.90), CIDR IP subnets (10.100.0.0/16) and/or DNS wildcards (*.acme.com). Once you have entered your restrictions, click Update and the changes will take effect.

Please note that Stingray supports CIDR networks with a netmask of /8, /16, /24 or /32 only.

Admin Server Port

Communication with the admin server uses a single port. If there is a firewall between your web browser and the Admin Server, you will need to configure it to allow this port through. It is important that you prevent untrusted sources from accessing this port.

Should your security arrangements require the use of a different port to that offered, you can specify it in this section. The UI will tell you if the new port is already in use. Simply click Update to confirm the change; the page will refresh to a waiting page and after the software has restarted it will return to the Admin Security page.

SSH Server

Stingray appliances provide SSH access for log retrieval and certain low-level administrative functions.

In this section you can choose whether or not SSH access to the appliance is enabled and which port the SSH server listens on.

Once you have entered your required configuration click Update to confirm the change and reconfigure the SSH service.

When SSH is disabled any active SSH connections will be terminated immediately.

Cluster Communications

Communication between cluster members is handled via secure communications designed to withstand man-in-the-middle and other types of attacks or interventions.

This section allows you to place restrictions on the inter-cluster communications in order to provide the precise level of security for your network setup.

The host IP addresses that can contact the internal administration port on each traffic manager can be specified by the setting controlallow. This should be a list containing IP addresses, CIDR IP subnets, and localhost; or it can be set to all to allow any host to connect.

If your cluster spans into an untrusted network, the risk of security compromise to your remote cluster members is greater. Therefore you may wish to mark those members as being untrusted. An untrusted traffic manager can still receive configuration updates, and will still broadcast state/statistical data, but effectively becomes unable to replicate configuration updates out to the other cluster members.

To enable this functionality, each traffic manager in the cluster has a control!canupdate setting. This can either be enabled for trusted traffic managers, or disabled for untrusted ones. You must have more than one traffic manager in your cluster to use this setting.

control!canupdate!default: This setting provides the default state for new traffic managers to inherit when they join the cluster. You may wish to modify this to No prior to joining a new traffic manager from a less trusted location.

Click Update to make any changes.

The Admin UI and Control API on untrusted traffic managers will be disabled for security purposes. You should ensure that you have made all necessary changes to any machine-specific configuration (e.g. Networking, Time, EC2) for those traffic managers prior to disabling the control!canupdate flag.
You should ensure you have a suitable number of redundant trusted traffic managers present in order to ensure that you do not lose administrative control over your cluster.

SSL Settings for Admin Server and Internal Connections

These settings control advanced SSL options for connections to the admin server and secure connections internal to the traffic manager. The default settings offer a broad level of security and compatibility suitable for most installations. Consult your system administrator or support provider should you wish to enable compatibility with a specific protocol or connection setting.

admin!support_ssl2
Whether or not SSLv2 support is enabled for admin server and internal connections. (Default: No)
admin!support_ssl3
Whether or not SSLv3 support is enabled for admin server and internal connections. (Default: No)
admin!support_tls1
Whether or not TLS 1.0 support is enabled for admin server and internal connections. (Default: Yes)
admin!support_tls1_1
Whether or not TLS 1.1 support is enabled for admin server and internal connections. (Default: Yes)
admin!ssl3_ciphers

This is a list (space, comma or colon separated) of cipher suites that will be used for performing SSL decryption or SSL encryption. The order of the supplied list determines the priority of the ciphers for SSL decryption.

The default order is:

  1. SSL_RSA_WITH_AES_128_CBC_SHA
  2. SSL_RSA_WITH_AES_256_CBC_SHA
  3. SSL_RSA_WITH_3DES_EDE_CBC_SHA

In addition, the other ciphers supported by ssl!ssl3_ciphers are supported but disabled by default.

admin!max_handshake_message_size

The value of this setting determines the maximum size of SSL handshake messages accepted for SSL connections. Any handshake message indicating a size larger than this setting will cause the SSL connection to fail and will be logged as a potential DoS attack. The default value of 10KiB should be able to accept a chain of 5 certificates, which should be more than sufficient for typical SSL set-ups.

A value of 0 is a special value indicating that there is no limit to the size of SSL handshake messages handled by the system.

admin!ssl3_allow_rehandshake

Both SSLv3 and TLS (Transport Layer Security) protocols allow either the client or server to initiate renegotiation of the secure connection. This might be to establish new cryptographic parameters by which the connection will be governed.

During renegotiation, the secure connection becomes potentially vulnerable to interception by an attacker who might seek to inject traffic as a prefix to the client's interaction with the server. This mechanism, known as a Man-in-the-Middle (MitM) attack, can be used to set up a new client connection from the attacker, fooling the target server into believing that the initial data transmitted by the attacker is from the same entity as the original client.

Furthermore, renegotiation can be used to carry out a Denial of Service (DoS) attack because it poses a much higher load on the server than on the client. A client could simply request a re-handshake at a very high rate causing a very high computational burden on the server. To protect against such attacks, Stingray rate-limits TLS renegotiations on connections to the admin server, see the setting admin!ssl3_min_rehandshake_interval below.

RFC-5746 introduces a TLS extension that prevents the MitM attack by cryptographically tying renegotiations to the client that is performing it. However, the introduction of this extension does not necessarily prevent or protect from a DoS attack.

The admin!ssl3_allow_rehandshake setting allows you to select how a potential renegotiation handshake should be handled. The following options are provided:

Always allow
Renegotiation is always allowed, even if the client lacks support for RFC 5746, but without any form of protection against intervention by a third party. This setting is NOT RECOMMENDED, and could leave your system open to MitM or DoS attacks.
Allow safe re-handshakes
This includes the case in which the client supports RFC 5746 and the case that no data has yet been transmitted over the connection. Since the aforementioned attack consists of pre-pending plain text, if no data has yet been received, the re-handshake is safe. This is of limited use as from the client's perspective, the re-handshake is actually the first handshake, so the client cannot know whether the connection is under attack. This option is therefore mostly provided for backward compatibility with clients that have yet to be upgraded to support RFC 5746. Note that since this setting allows re-handshakes it still leaves an installation potentially open to the DoS attack mentioned above.
Only if client uses RFC 5746 (Secure Renegotiation Extension) [default setting]
Renegotiation handshakes are only allowed if the client supports Secure Renegotiation as defined in RFC 5746. Note that since this setting allows re-handshakes it still leaves an installation potentially open to the DoS attack mentioned above.
Never allow
Reject all attempts at a renegotiation handshake. This is the most secure method as it protects against both MitM and DoS attacks. However, service failure is possible if, for example, some aspect of your installation depends on client-side renegotiation.

admin!ssl3_min_rehandshake_interval

If SSL3/TLS re-handshakes are supported, this setting defines the minimum time interval (in milliseconds) between handshakes on a single SSL3/TLS connection that is permitted. The time interval starts when the opening handshake is initiated and gets reset at the beginning of every re-handshake. (Default: 1000 milliseconds)

To disable the minimum interval for handshakes the setting should be set to the value 0.

Both SSLv3 and TLS (Transport Layer Security) protocols allow either the client or server to initiate renegotiation of the secure connection. This might be to establish new cryptographic parameters by which the connection will be governed.

A renegotiation can be used to carry out a Denial of Service (DoS) attack because it poses a much higher load on the server than on the client. A client could simply request a re-handshake at a very high rate causing a very high computational burden on the server.

admin!insert_extra_fragment

Whether or not SSL3 and TLS1 use one byte fragments to avoid predictable initialization vectors. (Default: No)

This setting determines whether one byte fragments are used with SSL block ciphers in CBC mode as a countermeasure for the "BEAST" vulnerability (CVE-2011-3389).

This is actually a browser vulnerability, and setting this option is neither necessary to avoid the attack, nor sufficient if you use a vulnerable client. It exists for customers who need to pass testing by vulnerability scanners that don't distinguish the context in which SSL is being used.

Disabling SSL3 and TLS1.0 and allowing only TLS1.1 will avoid the vulnerability, but it may also limit client interoperability.

admin!ssl3_diffie_hellman_key_length

This setting determines the length of the key used in ephemeral Diffie-Hellman key agreement. It is only relevant for ciphers that use this key agreement algorithm, for example, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA. Longer keys mean more secure connections, but also more CPU load.

REST API

These settings control how JSON-formatted REST API connections over a secure connection to the traffic manager are managed. The default settings offer a broad level of security and compatibility suitable for most installations.

rest!enabled
This setting enables or disables access to the REST API server (Default: No)
rest!port
This setting defines which port the REST API server listens on for incoming connections from clients making API requests. (Default: 9070)
rest!bindips
This setting defines a list of IP Addresses which the REST API will listen on for connections. The list should contain IP addresses (IPv4 or IPv6) or a single entry containing an asterisk (*). This indicates that the REST API should listen on all IP Addresses.
If supplying a list of IP addresses, the local host addresses ( 127.0.0.1 and ::1 ) must be specified to enable them. (Default: *)
rest!auth_timeout
The REST API server maintains a cache of recent successful authentications, so that, for external authentication (for example when using an LDAP server) it is possible to avoided repeated querying for the same username/password combination. This setting controls how long in seconds a successful authentication event is kept in the cache for. No more lookups for this username/ password/IP address combination will occur for this number of seconds, and the user will continue to be allowed access. (Default: 120 seconds)
rest!replulltime
This setting defines how long in seconds there should be REST API inactivity before configuration replicatation starts between members of the same cluster. Increasing this setting may delay configuration replication amongst members of a cluster. (Default: 5 seconds)
rest!repabstime
This setting defines how long in seconds the REST API server will wait before starting configuration replication to other members of the cluster, regardless of REST API activity from clients. (Default: 20 seconds)
rest!reptimeout
This setting defines how long in seconds the REST API server will wait for configuration replication to succeed. (Default: 10 seconds)
rest!max_http_header_len
This setting defines the maximum length of an HTTP header passed into the REST API server. HTTP headers longer than this value will cause the REST request to be rejected by the server as invalid. This is to prevent denial-of-service attacks by malicious clients. (Default: 4096 bytes)

This page allows you to manage users that have access to the Stingray Admin Server. It is split into three sections - Local Users, Authenticators and Permission Groups. Each section can be unfolded to display its contents, or you can click on the section name (or Edit link) to display a more detailed summary page for each separate list. New users, authenticators and groups can be added from these summary pages.

Stingray Admin Server users fall into one of two categories:

Local Users

Local users are those accounts stored locally on a Stingray cluster. No external access requests are made by Stingray to authenticate users in this category, and all user preferences and data are maintained internally.

A factory-default 'admin' user is provided that has full control over all settings. This user can be removed, however you should ensure you have a suitable replacement with full administrative privileges in order to correctly maintain and administer your system.

A factory-default 'audit' user is provided that can delete the archived audit log files. The admin user cannot change the audit user's password or remove this user. Only the audit user can change their own password. The audit user's initial password can be set in the Initial Configuration wizard.

Clicking on a user's name will take you to the Edit page for that user.

Authenticators

Authenticators are externally-located services used to verify user logins NOT stored locally within your Stingray cluster. These can be externally-located LDAP, RADIUS, or TACACS+ services. Clicking on an authenticator name will take you to the Edit page for that authenticator.

Note that remotely authenticated users will not be listed on this page, nor will they appear anywhere else in the UI. Whilst Stingray will acknowledge that you are logged in as a remote user (the username will appear as usual in the toolbar), you will not be able to alter any preferences or settings for this user.

Permission Groups

Setting up Permission Groups allow you to control which pages a user can view or modify on a group level rather than doing it on a user-by-user basis. Click on a group name to edit the permissions for that group. You will be taken through to the Permission Group Edit page.

Suspended Users

This section provides a list of all the users that have been suspended and allows you to re-enable their accounts.


The Local Users page allows you to manage locally-stored users that have access to the Stingray Admin Server.

Users List

This is the list of users who can access the Admin Server. The factory-default 'admin' user has full control over all settings. All users can view and edit settings depending on the permissions of the group they belong to.

Clicking on a user's name, or clicking the appropriate Edit link, will allow you to change the password and various other settings for that user.

Password Policy Settings

This page allows you to configure the password policies for local users. Restrictions on the length of passwords, what character types they must contain, how often they can be changed and how often they must be renewed can be configured here.

Create New User

To add a new user, enter the new user name and password in the boxes provided, then select the group this user will belong to from the drop-down list. They will automatically inherit whatever permissions are set for that group, and should those permissions be modified each user belonging to the group will inherit the new settings. Remember to click Update to create the new user.


On this page you can modify the settings and preferences that are unique to a local user. These settings just affect the web-based user interface and do not affect the way that the product runs.

If you have appropriate permissions set, you can delete the user account completely via the section at the bottom. Please note that this action is irreversible.

Password

To change a user's password, enter the new password twice and press update.

Access Privileges

This section defines which group the user belongs to. It also holds a status control to allow administrators to suspend and reactivate individual user accounts. A user will not be able to modify these settings for their own account.

UI Preferences

user!admin!use_applet

Users can choose whether to enable or disable the 'applet' that is built into the top-left of the UI toolbar. This is enabled by default, and shows the current traffic for each virtual server. Disabling the applet might speed up your web browser.

user!admin!appletwidth

The width of the applet can be configured. If you are running many virtual servers, then the default applet width might be too small to show all of the services.

user!admin!trafficscript_editor

This option allows the user to make use of the advanced TrafficScript Editor features, such as syntax highlighting and indentation.


The Password Policy page allows you to configure the password policies applied when local users are created or when they change their passwords. Restrictions on the length of passwords, what character types they must contain, how often they can be changed and how often they must be renewed can be configured here.

Password Security Settings

Restrictions on the passwords users are allowed to create can be specified in this section.

password_security

This setting allows you to improve password security by requiring users' passwords to be of a certain length and to contain a range of character types.

The following password security options are available:

No restrictions
All passwords are allowed, no restrictions are applied.
Standard restrictions
Standard password security is applied to new passwords, specifically:
  • Passwords must be at least 8 characters in length.
  • Passwords must contain at least two alphabetic characters.
  • Passwords must contain at least one uppercase character.
  • Passwords must contain at least one numeric character.
  • Passwords must contain at least one special, non-alphanumeric character.
  • Passwords must not contain repeated consecutive characters, such as 'aaaaa'.
Custom restrictions
The minimum length of passwords and the types of characters they can contain can be specified manually.

password_reuse_after

This setting determines how often a particular password can be reused. When changing their password, users cannot choose a password that they have chosen for any of the previous number of passwords specified by this setting.

If set to 0, a user can reuse any passwords they have previously used.

Password Change Restrictions

This section defines restrictions on when passwords can change.

password_changes_per_day

This setting specifies how many times a user is allowed to change their password in a 24-hour period. If it is set to 0 then there is no limit to the number of times a password can be changed in one day.


The Edit Groups page allows you to manage Permission Groups. These control access to the Stingray Admin Server.

Permission Groups

Setting up Permission Groups allow you to control which pages a user can view or modify on a group level rather than doing it on a user-by-user basis. Click on a group name to edit the permissions for that group. You will be taken through to the Permission Group Edit page.

Groups can be deleted by selecting the appropriate checkbox next to each group name, and clicking Update. Note that the 'admin' group cannot be deleted, nor can its settings be changed (copying this group, however, is fine).

The timeout value for each group controls the auto-logout feature of the UI. If a member of the group leaves their web browser inactive for this period of time, then the system will log them out for security reasons.

Create New Group

Enter the name of the new group and click Update. If the name is acceptable and doesn't already exist, it is added to the list of Permission Groups and can be selected in the new user Group drop-down list. Note that the new group has all permission values set to 'none' and should be edited before any users assigned to that group can gain access to the Admin Server.


This page allows group access permissions to be changed.

Description

You can enter a brief description of this group in the box provided. This is displayed along-side the group name on the Access Management and Edit Local Users pages. Remember to click Update to save changes.

Login Timeout

The admin server provides an automatic timeout as a security feature. This stops casual users from using your browser if you leave it unattended for a period of time, and reduces the chance of XSS-style attacks. Each group has a separate timeout value, and each user within that group will automatically adopt the setting. Should you wish to change the default then enter a suitable value for the "Inactivity Timeout" then click Update. A value of 0 (zero) means "never time out".

Password Settings

The password_expire_time setting allows you to force users belonging to this group to change their passwords periodically. If a user's password expires they will be required to change it the next time they log in through the Stingray Administration Server. If a user's password has expired they will not be able to log in using SSH and they will not be able to use the SOAP API until they have changed their password using the Administration Server.

If the user does not have permission to change their own password (i.e. the Users > Local > Edit permission is not set to Full) then they will not be able to change their password when it expires.

If set to zero, passwords for members of this group will not expire. Note that password expiry applies only to locally authenticated users that belong to this group. It does not apply to remote authentication servers.

Permissions

You can set access rights to each page within Stingray, and the various features on that page, by setting the appropriate flag for the current group. Flag settings can be 'none' (for no access at all), 'read only' (for permission to view the data but make no changes), or 'full' (for full rights to view and change data). You can set all the flags in a particular section by clicking None, Read Only or Full in the section header. You can set ALL the flags to a particular setting by clicking the appropriate Set All link above each column. Remember to click Update after any changes are made here.

Copy Group

You can perform a 'Save As' operation by specifying a new group name in the box provided and clicking Save. All settings on the screen, regardless of whether Update has been clicked, will be saved to the new group. The original group is unchanged from the last update.


Authenticators

This is the list of Authenticators defined for Stingray. Each will be one of three types:

as shown in brackets after the authenticator name.

Clicking on an authenticator name, or clicking the appropriate Edit link, will take you to the edit page for that authenticator.

Remote users are tested against the authenticators in the order they are listed on this page (lexicographic order).

Create New Authenticator

To add a new authenticator, enter the new name in the box provided, then select the authenticator type. Now click Create Authenticator.


General Configuration

This section allows you to provide a short description of the authenticator, and to enable or disable it.

Disabling the authenticator means you can retain and modify the configuration without it actually being used for remote user authentication. This is useful as it allows you to test the configuration (using the section provided below) without any impact on your system. Enabling the authenticator means it becomes 'live', and remote user login authentication requests may be passed to it.

LDAP configurables

The options shown here will depend on the authenticator being of type LDAP.

ldap!server
This is the IP address or hostname of the LDAP server.
ldap!port
This is the port used to connect to the LDAP server.
ldap!timeout
The timeout period (in seconds) for a connection to the LDAP server.
ldap!basedn
The base DN (Distinguished Name) for directory searches.
ldap!filter
A filter that can be used to extract a unique user record located under the base DN. The string %u will be replaced by the username. This filter is used to find a user's bind DN when ldap!dnmethod is set to "Search", and to extract group information if ldap!groupfilter is not set. Examples: sAMAccountName=%u for Active Directory, or uid=%u for some Unix LDAP schemas.
ldap!dnmethod
The bind DN for a user can either be searched for in the directory using the ldap!basedn and ldap!filter values, or it can be constructed from the username. Using the "Search" method will be necessary if you have users under different base DNs and don't want to define separate LDAP Authenticators for every base DN required.
ldap!searchdn (only valid for a ldap!dnmethod of Search)
The bind DN to use when searching the directory for a user's bind DN. You can leave this blank if it is possible to perform the bind DN search using an anonymous bind.
ldap!searchpass (only valid for a ldap!dnmethod of Search)
If binding to the LDAP server using ldap!searchdn requires a password, enter it here.
ldap!binddn (only valid for a ldap!dnmethod of Construct)
Template to construct the bind DN from the username, the string %u will be replaced by the username. Examples: %u@mycompany.local for Active Directory or cn=%u, dc=mycompany, dc=local for both LDAP and Active Directory.
ldap!groupfilter
If groups are stored in LDAP records other than the unique user record this filter can be specified to extract the required records from the directory. The ldap!groupattr and ldap!groupfield will then be applied against all records matching the filter and all matching values are extracted. The values retrieved are sorted lexicographically and the first one to match a Permission Group will be used as the user's group. This will usually be required for Unix/POSIX-style LDAP schemas. An example is: (&(memberUid=%u)(objectClass=posixGroup))
ldap!groupattr
The LDAP attribute that gives a user's group. If there are multiple entries for the attribute all will be extracted and they'll be lexicographically sorted, then the first one to match a Permission Group name will be used.
ldap!groupfield
The sub-field of the group attribute that gives a user's group. For example, if ldap!groupattr is memberOf and this retrieves values of the form CN=mygroup, OU=groups, OU=users, DC=mycompany, DC=local you would set groupfield to CN (note that LDAP field and attribute matching is case-insensitive). If there are multiple matching fields only the first matching field will be used.
ldap!fallbackgroup
If ldap!groupattr is not defined, or returns no results for the user logging in, the group named here will be used. If not specified, users will be denied access to the traffic manager if no groups matching a Permission Group can be found for them in the directory.

RADIUS configurables

The options shown here will depend on the authenticator being of type RADIUS.

radius!server
This is the IP address or hostname of the RADIUS server.
radius!port
This is the port used to connect to the RADIUS server.
radius!timeout
The timeout period (in seconds) for a connection to the RADIUS server.
radius!secret
This is the secret key shared with the RADIUS server.
radius!groupvendor
The RADIUS identifier for the vendor of the RADIUS attribute that specifies an account's group. Leave blank if using a standard attribute * such as Filter-Id.
radius!groupattr
The RADIUS identifier for the attribute that specifies an account's group. May be left blank if radius!fallbackgroup is specified.
radius!fallbackgroup
If no group is found using the vendor and group identifiers, or the group found is not valid, the group specified here will be used.
radius!nas-ip-address
This value is sent to the RADIUS server, if left blank the address of the interfaced used to connect to the server will be used.
radius!nas-identifier
This value is sent to the RADIUS server.

TACACS+ configurables

The options shown here will depend on the authenticator being of type TACACS+.

tacacsplus!server
This is the IP address or hostname of the TACACS+ server.
tacacsplus!port
This is the port used to connect to the TACACS+ server.
tacacsplus!timeout
The timeout period (in seconds) for a connection to the TACACS+ server.
tacacsplus!secret
This is the secret key shared with the TACACS+ server.
tacacsplus!authtype
Authentication type to use, types supported are PAP and ASCII.
tacacsplus!groupsvc
The TACACS+ service that defines the group of an authenticated user. May be left blank if tacacsplus!fallbackgroup is specified.
tacacsplus!groupfield
The field of the TACACS+ service that defines the group of an authenticated user. Must be specified if tacacsplus!groupsvc is specified.
tacacsplus!fallbackgroup
If no group is found using group service and field, or the group found is not valid, the group specified here will be used.

Test Configuration

This section can be used to perform a test authentication using the username and password entered in the boxes provided. Clicking the 'Update and Test' button will perform the dual action of saving the current configuration and then testing the username for authenticity.


This section provides a list of all the users that have been suspended and allows you to re-enable their accounts. Suspended users will not be able to access the Stingray Administration Server or access the SOAP interface or log on via SSH.

A user can be suspended for a variety of reasons, for example if they have exceeded the max_login_attempts configured in the System > Global Settings > Login and Security Settings section of the Administration Server, or if their account has been manually suspended on the Local Users settings page.

Suspended Users

This list shows all the users whose accounts have been suspended. To remove a suspension and allow the user to access the Administration Server, check the box next to their name and click 'Enable Selected Users'.


Backups

This page allows you to manage backups of your configuration.

What is a backup?

A backup is a snapshot of the whole configuration to which you can roll-back your setup. They are archived and saved as a tarball. For extra security you can export them to your local machine and write them to a back-up storage device.

The backup file will contain sensitive information including all SSL keys not stored on secure hardware. It should be kept secure.

Backups List

This table shows all the backups that have been created on this administration server, along with the time they were created and a short description.

To view a summary of the settings contained in a backup, click on the backup name in the table.

To compare two backups to see where they differ, select any two backups by ticking the checkboxes and hit compare. You can also compare a backup with the current configuration.

Create a Backup

A saved backup is stored on the admin server on which it was created. You do not have to use the default name (but you do need to use a unique name to save it) and the description is optional.

Import a Backup

To import a backup, browse to the file on your local machine and select Import to upload it to the admin server, where it will be added to the backups list.

Exporting and restoring backups

This page does not directly provide the means to export or restore configuration backups. You must first click on the name of the backup to display it's summary. From here you can select the Export or Restore options at the bottom of the page.

Partial Backups

Use the link in this section to access the Partial Backups management page. Partial backups contain subsets of configuration and can be used to migrate services between separate clusters.


This page shows the differences between two traffic manager configurations.

You are presented with a number of foldable sections, one for each type of object (virtual servers, pools, rules, etc.) where differences are detected. In each section, you may see a number of the following:

File existence differences are shown as a table of ticks and crosses to identify where a file exists in one config but not the other. The following example shows the different pools that exist when comparing a saved config "checkpoint" with the current config.

Config key changes within individual files will be shown in a similar table, one for each file where changes are detected. The names of changed items are listed in the table, and the conflicting values are shown alongside in two separate columns. A grey cross in this section refers to where a value has been added, removed or changed from previously being blank. The following example shows two files, settings.cfg and security, where one or more key differences have been detected between the saved config "SavedConf" and the current config.

Should there be both file and config key differences in a particular section, you will see an instance of each of the above tables.


This section allows you to import and export backups that contain only a subset of a full configuration. This can be useful when trying to copy specific services to other Stingray clusters. Unlike a regular configuration import, the configuration being imported is merged with the existing one instead of replacing it.

This section provides similar functionality to the command line tool zconf. See the section Granular Configuration Import/Export with zconf in the User Manual.

Import

Importing partial backups can lead to an inconsistent configuration. Always review the diffs presented when importing a partial backup. It is recommended that you create a full backup point before applying a partial backup.

This section allows you to import a partial backup or full backup. You can provide an Include Only filter to import only some of the configuration from the uploaded tar file. When using an include filter the system will also import any objects on which the selected objects depend, such as the pools that a virtual server uses. The Include Filters section below details the format of these filters.

After uploading a backup and optionally specifying a filter you will be presented with a diff listing the changes that will be made to the system. After reviewing the diff and ensuring everything is correct click Apply Partial Backup to commit the backup.

Export

The export section is used to download partial configuration backups. Setting an Include Only filter makes the system export only the configuration objects that match this filter, along with their dependencies. The Include Filters section below details the format of these filters.

Include Filters

The include filter is a space separated list of entries in the following format:

[CONFIGURATION TYPE]
OR
[CONFIGURATION TYPE]/[NAME]
OR
[CONFIGURATION FILE]
When a configuration name has spaces in it, they can be escaped with a back slash ('\'). You can include the 'settings.cfg' configuration file to backup your global settings, and the 'users' configuration file to backup your local user settings.

For example, to import all virtual servers, the monitor 'Primary Database Monitor' and your global settings you can use the following filter:

vservers
monitors/Primary\ Database\ Monitor
settings.cfg

The following table lists the different configuration types you can choose to include:

IdentifierDescription
actionprogs Action Programs
actions Alerting Actions
activitymonitor Current Activity Graphing Data Settings
auth Authenticators
bandwidth Bandwidth Classes
cloudcredentials Autoscaling Cloud Credentials
events Alerting Event Types
extra Miscellaneous Files
flipper Traffic IP Groups
groups User Groups
jars Java Servlets and Related Files
licensekeys License Keys
monitors Monitors
persistence Session Persistence Classes
pools Pools
protection Service Protection Classes
rate Rate Shaping Classes
scripts Monitor Scripts
services GLB Services
slm Service Level Monitoring Classes
ssl/cas SSL Certificate Authorities
ssl/client_keys SSL Client Certificates/Keys
ssl/dnssec_keys DNSSEC Keys
ssl/server_keys SSL Server Certificates/Keys
supplementarykeysSupplementary Licence Keys
vservers Virtual Servers

This page allows you to examine the contents of a configuration backup. This is useful if you are intending to restore a previously backed-up configuration and the description does not adequately describe its contents.

The configuration is shown in the same grid format used by the Config Summary. The only difference is that you cannot interrogate individual objects on this page. For a full description of the layout and capabilities of this grid, you should refer to the Config Summary Help page.

Basic Settings

In this section you can modify the title and description of your backup. Click Update to make the changes.

Export Backup

You can download your configuration in this section in the form of a TAR archive file. Archives of this type can be uploaded on the Backups page. The backup file will contain sensitive information including all SSL keys not stored on secure hardware. It should be kept secure.

Restore Configuration

You can use this section to set this backup as the current configuration. Take note that this operation cannot be reversed, and the current configuration WILL BE LOST! Whilst configuration backups are stored on the individual admin server they are created on, remember that restoring a backup will replicate this configuration across the whole cluster.

Delete Backup

You can remove this configuration backup completely in this section.


Your traffic managers need valid license keys to operate. License keys are restricted by IP address or MAC address, and may be limited to certain versions or dates. They may enable additional optional product features across one or more of your traffic managers.

Installed License Keys

This list shows all the licenses for your cluster. If a license expires it will remain in the list but be marked as expired. To remove an expired key, check the box and hit Remove Selected Keys.

Install new License Key

New licenses can be installed using the file upload provided.

It can take a few moments for new license keys to filter across your cluster.

Date and Time

It is important that all the clocks on your traffic managers and your back-end nodes are synchronized. If the times are out of sync, it is harder to relate the event logs of all machines.

Note that, unlike most other settings in the Admin interface, any settings you configure on this page will apply only to the traffic manager whose admin interface you are accessing. If you want to set the time for a different traffic manager in your cluster, you should use the Admin Interface for that machine.

Basic Settings

Time Zone, Date and Time: select the time you want and hit the update button at the bottom of the page.

If you manually set the time backwards (i.e. more than 10 seconds into the past), Stingray will have to automatically restart itself (and other time-based system software).

NTP Settings

To sync the time to an NTP server: Add an NTP server (by entering its name and clicking the update button at the bottom of the page) and when it appears, press 'Sync Time Now'.

Once an NTP server is set the traffic manager will periodically poll the NTP server and sync the time automatically. NTP should never cause a traffic manager to restart (eg when it moves into or out of daylight-saving time)

The time on this traffic manager is automatically kept in sync with the host machine. Ensure that the host machine has ntp running and correctly configured.

To change the time zone of this traffic manager, select the correct time zone and hit the update button. When the time zone is change the software is automatically restarted.


This section allows you to manage the Cloud Steelhead discovery agent included with this virtual appliance. The discovery agent intercepts any traffic that can be optimized and forwards it to a Cloud Steelhead in the local data center or cloud. The data is then returned to the traffic manager for processing.

Discovery Agent Settings

Use these settings to enable the discovery agent and configure which Cloud Steelheads this traffic manager should use to optimize traffic.

Enable

Setting enabled to Yes starts the agent and attempts to connect to a Steelhead using configured discovery mode.

Mode

The mode used to discover your Cloud Steelheads in the local data center or cloud. Can be one of:

  • Riverbed Portal
    Use the standard Riverbed cloud portal to manage your Cloud Steelheads. This is usually only used on Amazon EC2.
    You must also configure the following settings when using this mode:
    • Client ID - The identifier for this server listed on the Riverbed cloud portal.
    • Client Key - The key for this server listed on the Riverbed cloud portal.
    • Proxy Hostname/IP - If the Riverbed cloud portal is accessed via a proxy, enter its hostname or IP address. Otherwise leave it blank.
    • Proxy Port - If a proxy hostname or IP address is specified you must also enter the port to use.

  • Local Portal
    Use an alternate portal to manage your Cloud Steelheads.
    You must also configure the following settings when using this mode:
    • Portal Hostname/IP - The hostname or IP address of the portal you are using to manage your Cloud Steelheads and servers.
    • Client ID - The identifier for this server listed on the portal.
    • Client Key - The key for this server listed on the portal.
    • Proxy Hostname/IP - If the portal is accessed via a proxy, enter its hostname or IP address. Otherwise leave it blank.
    • Proxy Port - If a proxy hostname or IP address is specified you must also enter the port to use.

  • Manual
    Manually configure the IPs of your Cloud Steelheads.
    You must also configure the following settings when using this mode:
    • Steelhead IPs - The IP addresses of all the Cloud Steelheads you want to use to optimize traffic. If using priority load balancing this list should be in order of priority, with the highest priority Steelhead last.
    • Load Balancing Method - When multiple Cloud Steelheads are available one is selected using either 'Round Robin' or 'Priority' load balancing. In round robin mode each contactable Steelhead is used in turn. In priority mode the last contactable Steelhead in the IP list is used, continuing up the list.

Log Level

This setting controls how verbose the logs produced by the Cloud Steelhead discovery agent are. The level selected is the lowest severity that will be logged. Setting the log level to Debug produces large amounts of logging output. It will quickly fill up the appliance's log partition if left at this level. Therefore Debug mode should only be used for short periods of time.

Restart Discovery Agent

If the discovery agent is not forwarding traffic correctly it can be restarted to attempt to fix the problem.

Recent Discovery Agent Logs

This section displays the last 30 lines of the discovery agent logs if they are available. The entire log file can be downloaded using the download button at the top of this section.

After the log entries is the current size of the logs in kilobytes and a button to clear the entire log.

The Riverbed Cloud Steelhead discovery agent is only available on VMWare and EC2 virtual appliances.


These are the various global settings that control the behavior of the traffic managers. They control aspects such as logging and performance.

Care should be taken when modifying any of these settings. The default values have been chosen to give good performance on a wide range of systems, and to preserve the stability and security of the software. Configuring these settings incorrectly could compromise the stability and security of your system, and may impact performance.

Some of the more interesting settings that you may want to alter are:

EC2 Account Settings

This section allows you to provide your EC2 account details so the traffic manager can assign Elastic IPs. If you do not require fault tolerance support then this section can be left blank.

System Settings

These define the network and system settings for each traffic manager.

listen_queue_size

The maximum backlog of pending connections that Stingray will queue. If the number of incoming connections increases temporarily beyond the speed at which Manager can handle them then they will be added to this queue.

If your site experiences large 'spikes' of traffic, then raising this value may improve performance. This will not solve performance issues arising from a consistent rate of traffic that is too high for Stingray to process however. It may also be necessary to increase the operating system listen queue:

  • Linux - sysctl -w net.core.somaxconn=<value>
  • Solaris - ndd -set /dev/tcp tcp_conn_req_max_q <value>

Refer to your operating system manual for instructions on how to preserve the system value over a reboot.

multiple_accept

If set, Stingray will try to speculatively accept additional connections from a client after it has accepted the first connection. This can improve performance under some very specific conditions, however in general it is recommended that this be set to 'No'. (When set, multiple_accept can have a substantial negative effect for clients connecting to multiple IP addresses. A small improvement might be seen for clients connecting to just a single IP address.)

client_first_opt

Should Stingray make use of TCP optimizations to defer the processing of new connections until the client has sent some data? This improves the efficiency of Stingray when handling high rates of connections/second. It only affects protocols where the client sends the first data (e.g. HTTP). However, on some machines it may prevent idle connections (those that have never sent any data) from being timed out.

dns!size

Stingray maintains its own DNS cache of hostnames, which is used to speed up features like the access logging. This setting controls the maximum size of that cache.

dns!min_ttl

If this setting isn't zero, Stingray caches DNS settings for at least this long, overriding the Time To Live value from a nameserver - if you can accept a less accurate DNS resolver, then you may wish to increase the minimum caching time.

dns!max_ttl

Stingray limits the caching of DNS settings to this value even if a nameserver reports a longer Time To Live. If you find nameservers are returning overly optimistic lifetimes and you want a more accurate DNS resolver, then you may wish to decrease the maximum caching time.

dns!negative_expiry

When a nameserver reports that a domain does not exist, Stingray caches that result for this long. If you want a more accurate DNS resolver, then you may wish to decrease the caching time for negative results.

dns!timeout

The timeout used when waiting for a response from a DNS server.

maxfds

The maximum number of file descriptors that Stingray will try to allocate. You may want to raise this if you have many simultaneous connections, although you cannot choose a value above the 'hard' limit set in your operating system. You should refer to the documentation supplied with your particular operating system for full instructions on how and when to modify this limit.

chunk_size

When the operating system informs Stingray that it can read data from the network, it will attempt to read in this amount of information in one go. Setting a larger value can lead to greater efficiencies, especially for handling larger connections. However, it also increases memory usage, which may be an issue if the traffic manager is processing very large numbers of concurrent connections.

ftp_data_bind_low

FTP data transfers consist of two separate TCP connections. First, the client connects to Stingray (usually on port 21) to create the 'control connection'. To send a file, Stingray creates a separate 'data connection' back to the client. The FTP specifications require this connection to originate from port 20.

Stingray cannot usually use port 20 because it runs in a high-security mode and does not have permission to open ports below 1024. By setting this value to 'Yes' Stingray will restart with appropriate permissions to use ports below 1024. Most FTP clients do not enforce the restriction that data connections must originate from a specific port because of these security concerns. It is recommended that this setting be changed to 'Yes' only if you are sure the FTP client requires it.

Once the setting has been applied, the ftp_data_source_port key contained in the FTP Connection Management settings page can be set below 1024. Data connections will be established on the port specified by that setting.

Cache Settings

These settings control the behavior of the caches in each traffic manager.

webcache!max_file_num

This setting limits the maximum number of entries that can be placed into the cache. Approximately ( webcache!max_file_num * 1.2 ) kB of metadata will be allocated in addition to the memory reserved for the content cache. For optimal use of the system memory, this value should be set such that webcache!size / webcache!max_file_num corresponds roughly to the average size of the files you expect to serve. If necessary, Stingray internally adjusts the number of files such that there are at least 256 bytes per file, given the cache size.

webcache!verbose

The X-Cache-Info header is added to every HTTP response, showing whether the request and/or the response was cacheable. It may have one of the following values, where the first two values correspond to a response being cached while the others explain why it is not cacheable.

  • cached
  • caching
  • not cacheable; request had a content length
  • not cacheable; request wasn't a GET or HEAD
  • not cacheable; request specified "Cache-Control: no-store"
  • not cacheable; request contained Authorization header
  • not cacheable; response had too large vary data
  • not cacheable; response file size too large
  • not cacheable; response code not cacheable
  • not cacheable; response contains "Vary: *"
  • not cacheable; response specified "Cache-Control: no-store"
  • not cacheable; response specified "Cache-Control: private"
  • not cacheable; response specified "Cache-Control: no-cache"
  • not cacheable; response specified max-age <= 0
  • not cacheable; response specified "Cache-Control: no-cache=..."
  • not cacheable; response has already expired
  • not cacheable; response is 302 without expiry time
  • not cacheable; meta data too large

webcache!normalize_query

This setting makes caching of requests with query-strings more efficient. Imagine a web-application in which a Java Server Page called app.jsp takes two arguments, a and b. If a request is first made to 'app.jsp?a=1&b=0' and then 'app.jsp?b=0&a=1' (order of variable-assignments inverted), the second response will be served from the cache if this setting is active. The only reason to disable this feature would be a web application that deviates from the conventional meaning of '&' and '=' in the query string.

ip_cache_size

This cache stores data for the IP-based session persistence. The size of this cache controls how many simultaneous IP-based sessions can be supported by Stingray.

FIPS 140-2 Configuration

This setting enforces the use of a FIPS 140-2 validated cryptographic module and limits configuration settings to values that are approved, allowed or permitted for operational environments relevant to FIPS 140.

fips!enabled

When true all* the cryptographic operations performed in the context of traffic received and sent by the Stingray Traffic Manager will be carried out using the FIPS 140-2 validated Riverbed Cryptographic Module. This mode of operation in the Stingray Traffic Manager is referred to as "FIPS Mode".

Affected features include:

  • TLS cryptographic operations for connections to virtual servers.
  • TLS cryptographic operations for connections from the Stingray Traffic Manager to nodes.
  • Verification and signing with cryptographic certificates, such as TLS (client and server) certificate chain validation (including consideration of CRLs) and OCSP.
  • GLB services with that operate on DNSSEC responses.

The traffic manager must be restarted when this setting is changed.

The cryptographic module cannot be used with the SSL 2 or SSL 3 protocol, or with those cipher suites using non-approved algorithms - see the ssl!ssl3_ciphers setting for more details.

The cryptographic module cannot be used with cryptographic certificates and keys that are disallowed when operating in a FIPS compliant environment - see the SSL catalogs for more details.

For more information about FIPS 140-2 on the Stingray Traffic Manager, see the User Manual.

* Some cryptographic operations may not be available from a FIPS 140-2 validated cryptographic module, but are required for interoperability. For more details on how this is reconciled please consult the User Manual.

SSL Configuration

These settings control the way Stingray manages and caches SSL traffic data.

ssl!cache!size

Each traffic manager maintains a single cache of SSL sessions previously used by any virtual server performing SSL decryption. This permits clients to resume previously used sessions and reduce the cost of SSL handshakes.

This setting defines the maximum number of sessions which may be stored in this cache. Once the number is reached, old sessions will be replaced by new sessions.

ssl!cache!expiry

This setting defines a timeout to establish for how long the SSL session IDs are stored in the session ID cache. This timeout applies from the last use of the session ID.

ssl!ocsp_cache!size

This setting determines the maximum number of OCSP responses that will be cached. The amount of time for which an OCSP response is cached can be specified using the 'ssl_ocsp_max_response_age' virtual server setting.

If set to 0, no OCSP responses will be cached and the chosen OCSP responder will be contacted every time a client certificate is received.

ssl!crl_mem!size

This is the amount of shared memory to allocate for loading SSL Certificate Revocation Lists (CRLs). This memory is allocated at startup, so changing this value will require a restart of the software. It should be set to at least 3 times the expected total size of all CRL files to be loaded.

ssl!support_ssl2
ssl!support_ssl3
ssl!support_tls1
ssl!support_tls1.1

These flags enable or disable support for specific SSL/TLS versions when performing SSL decryption or SSL encryption.

ssl!ssl3_ciphers

This is a list (space, comma or colon separated) of cipher suites that will be used for performing SSL decryption or SSL encryption. The order of the supplied list determines the priority of the ciphers for SSL decryption.

The default order is (the number in parentheses is the IANA registered value):

  1. SSL_RSA_WITH_AES_128_CBC_SHA (0x00, 0x2F)
  2. SSL_DHE_RSA_WITH_AES_128_CBC_SHA (0x00, 0x33)
  3. SSL_RSA_WITH_AES_256_CBC_SHA (0x00, 0x35)
  4. SSL_DHE_RSA_WITH_AES_256_CBC_SHA (0x00, 0x39)
  5. SSL_RSA_WITH_3DES_EDE_CBC_SHA (0x00, 0x0a)
  6. SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA (0x00, 0x16)
  7. SSL_RSA_WITH_RC4_128_SHA (0x00, 0x05)

In addition, the following ciphers are supported but disabled by default:

  1. SSL_RSA_WITH_RC4_128_MD5 (0x00, 0x04)
  2. SSL_RSA_WITH_DES_CBC_SHA (0x00, 0x09)
  3. SSL_DHE_RSA_WITH_DES_CBC_SHA (0x00, 0x15)
  4. SSL_RSA_EXPORT_WITH_DES_CBC_SHA (0x00, 0x62)
  5. SSL_RSA_EXPORT_WITH_RC4_56_SHA (0x00, 0x64)
  6. SSL_RSA_EXPORT_WITH_RC4_56_MD5 (0x00, 0x60)
  7. SSL_RSA_EXPORT_WITH_DES40_CBC_SHA (0x00, 0x08)
  8. SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA (0x00, 0x14)
  9. SSL_RSA_EXPORT_WITH_RC4_40_MD5 (0x00, 0x03)
  10. SSL_RSA_WITH_NULL_SHA (0x00, 0x02)
  11. SSL_RSA_WITH_NULL_MD5 (0x00, 0x01)

Only the following cipher suites are available when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled):
  • SSL_RSA_WITH_AES_128_CBC_SHA (0x00, 0x2F)
  • SSL_DHE_RSA_WITH_AES_128_CBC_SHA (0x00, 0x33)
  • SSL_RSA_WITH_AES_256_CBC_SHA (0x00, 0x35)
  • SSL_DHE_RSA_WITH_AES_256_CBC_SHA (0x00, 0x39)
  • SSL_RSA_WITH_3DES_EDE_CBC_SHA (0x00, 0x0a)
  • SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA (0x00, 0x16)
ssl!max_handshake_message_size

The value of this setting determines the maximum size of SSL handshake messages accepted for SSL connections. Any handshake message indicating a size larger than this setting will cause the SSL connection to fail and will be logged as a potential DoS attack. The default value of 10KiB should be able to accept a chain of 5 certificates, which should be more than sufficient for typical SSL set-ups.

A value of 0 is a special value indicating that there is no limit to the size of SSL handshake messages handled by the system.

ssl!insert_extra_fragment

This setting determines whether SSL3 and TLS will use one byte fragments to avoid predictable cipher initialization vectors.

Enabling this setting provides a countermeasure to the "BEAST" vulnerability (CVE-2011-3389).

This is actually a browser vulnerability, and setting this option is neither necessary to avoid the attack in normal use, nor sufficient if you use a vulnerable client. It exists for customers who need to pass testing by vulnerability scanners that don't distinguish the context in which SSL is being used.

Disabling SSL3 and TLS1.0 and allowing only TLS1.1 will avoid the vulnerability, but may limit interoperability with peers.

ssl!prevent_timing_side_channels

This setting determines whether additional steps will be taken when processing SSL3 or TLS data to minimize any timing side-channels that may leak confidential information.

While most significant timing side-channels are protected against by default, this setting controls those measures which have an observable and significant effect on performance relative to the practical severity of any attacks against such vulnerabilities.

Specifically, enabling this setting will provide a countermeasure to the "Lucky Thirteen" vulnerability (CVE-2013-0169).

Configuring this setting is the recommended way of addressing the "Lucky Thirteen" vulnerability, however an attack may also be mitigated entirely by setting ssl!ssl3_ciphers such that no block ciphers are configured as available.

ssl!ssl3_allow_rehandshake

Both SSLv3 and TLS (Transport Layer Security) protocols allow either the client or server to initiate renegotiation of the secure connection. This might be to establish new cryptographic parameters by which the connection will be governed.

During renegotiation, the secure connection becomes potentially vulnerable to interception by an attacker who might seek to inject traffic as a prefix to the client's interaction with the server. This mechanism, known as a Man-in-the-Middle (MitM) attack, can be used to set up a new client connection from the attacker, fooling the target server into believing that the initial data transmitted by the attacker is from the same entity as the original client.

Furthermore, renegotiation can be used to carry out a Denial of Service (DoS) attack because it poses a much higher load on the server than on the client. A client could simply request a re-handshake at a very high rate causing a very high computational burden on the server. To protect against such attacks, Stingray rate-limits TLS renegotiations on connections to decrypting virtual servers, see the setting ssl!ssl3_min_rehandshake_interval below.

RFC-5746 introduces a TLS extension that prevents the MitM attack by cryptographically tying renegotiations to the client that is performing it. However, the introduction of this extension does not necessarily prevent or protect from a DoS attack.

The ssl!ssl3_allow_rehandshake setting allows you to select how a potential renegotiation handshake should be handled. The following options are provided:

Always allow
Renegotiation is always allowed, even if the client lacks support for RFC 5746, but without any form of protection against intervention by a third party. This setting is NOT RECOMMENDED, and could leave your system open to MitM or DoS attacks.
Allow safe re-handshakes [default setting]
This includes the case in which the client supports RFC 5746 and the case that no data has yet been transmitted over the connection. Since the aforementioned attack consists of pre-pending plain text, if no data has yet been received, the re-handshake is safe. This is of limited use as from the client's perspective, the re-handshake is actually the first handshake, so the client cannot know whether the connection is under attack. This option is therefore mostly provided for backward compatibility with clients that have yet to be upgraded to support RFC 5746. Note that since this setting allows re-handshakes it still leaves an installation potentially open to the DoS attack mentioned above.
Only if client uses RFC 5746 (Secure Renegotiation Extension)
Renegotiation handshakes are only allowed if the client supports Secure Renegotiation as defined in RFC 5746. Note that since this setting allows re-handshakes it still leaves an installation potentially open to the DoS attack mentioned above.
Never allow
Reject all attempts at a renegotiation handshake. This is the most secure method as it protects against both MitM and DoS attacks. However, service failure is possible if, for example, some aspect of your installation depends on client-side renegotiation.

ssl!ssl3_min_rehandshake_interval

If SSL3/TLS re-handshakes are supported, this setting defines the minimum time interval (in milliseconds) between handshakes on a single SSL3/TLS connection that is permitted. The time interval starts when the opening handshake is initiated and gets reset at the beginning of every re-handshake. (Default: 1000 milliseconds)

To disable the minimum interval for handshakes the setting should be set to the value 0.

Both SSLv3 and TLS (Transport Layer Security) protocols allow either the client or server to initiate renegotiation of the secure connection. This might be to establish new cryptographic parameters by which the connection will be governed.

If the Stingray software acts as an SSL server (i.e., when ssl_decrypt is set to 'Yes' in a Virtual Server) and a re-negotiation is triggered by Stingray itself via the TrafficScript function ssl.requirecert(), the resulting renegotiation won't be subject to the rate limit.

A renegotiation can be used to carry out a Denial of Service (DoS) attack because it poses a much higher load on the server than on the client. A client could simply request a re-handshake at a very high rate causing a very high computational burden on the server.

ssl!ssl3_diffie_hellman_key_length

This setting determines the length of the key used in ephemeral Diffie-Hellman key agreement. It is only relevant for ciphers that use this key agreement algorithm, for example, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA. Longer keys mean more secure connections, but also more CPU load. If an export cipher is used (these are normally disabled), this setting is ignored and the length will be 512 bits.

ssl!ocsp_stapling!mem_size

This and the subsequent option control processing of the TLS Certificate Status Request Extension, as described in RFC 6066 (commonly known as OCSP stapling). Some virtual servers may have the OCSP stapling feature enabled, in which case the traffic manager will attempt to maintain a shared store of up-to-date OCSP responses. This setting defines the amount of memory to allocate for the store of OCSP responses.

ssl!ocsp_stapling!default_refresh_interval

The OCSP responses stored for OCSP stapling need to be refreshed periodically. Each OCSP response may include a 'next update' field, hinting when the response should be refreshed, but if the response did not contain a 'next update' field, or else the indicated time is in the past, this value will be used to determine the length of time between refresh attempts.

ssl!ocsp_stapling!maximum_refresh_interval

This value defines the maximum interval which may elapse between OCSP requests. After a valid OCSP response is received, the next update will be made this many seconds in the future, unless the 'next update' in the OCSP response is sooner.

ssl!ocsp_stapling!verify_response

If this is set to 'Yes', Stingray Traffic Manager will verify the signatures and validity periods of OCSP responses before using them for stapling.

ssl!ocsp_stapling!time_tolerance

An OCSP response has a validity period defined by two fields in the OCSP response: 'thisUpdate' and 'nextUpdate'. When 'verify_response' is set to 'Yes', responses outside this period will not be cached and therefore will not be stapled.

This setting defines an allowed margin outside this interval when responses will also be considered valid.

In particular, in some environments, clock skew may be a concern, and may cause the local current time to appear to be earlier than the 'thisUpdate' field in the response. A non-zero time tolerance will mitigate this concern.

SSL Hardware Support

These settings direct the traffic manager to delegate SSL decryption to specialised hardware (for extra security and/or speed).

Your appliance comes with the nCipher Support Software pre-installed; you can connect it to a NetHSM using the Add/Change/Remove buttons. You will then be able to use keys stored securely on the NetHSM. Note that the IP address of the Remote File System used by the NetHSM will also be required, as the nCipher Support Software uses local copies of some of the NetHSM's information.

ssld!library

Stingray supports SSL hardware using the RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki). If your hardware supports this interface, set this to PKCS#11 and see ssld!driver!pkcs11_lib.

Stingray also supports some SSL accelerators from Cavium Networks. To use these, select the appropriate card type here and enable ssld!accel.

ssld!driver!pkcs11_lib

Vendors of PKCS#11-compatible hardware will be able to provide a PKCS#11 interface library; you should provide the path to that library here, except for the following standard paths which will be used automatically:

  • /opt/nfast/toolkits/pkcs11/libcknfast.so
  • /usr/lib/pkcs11/PKCS11_API.so64
  • /usr/lib/pkcs11/PKCS11_API.so
  • /usr/lib/64/libpkcs11.so
  • /usr/lib/libpkcs11.so

ssld!driver!pkcs11_user_pin

This is the PIN required to create a read-only user session on the SSL hardware. Note that generally, PKCS#11 will address smart-card slots on your hardware, so a smart-card with appropriate permissions should be inserted. The PIN will be a property of the individual smart-card. If your hardware has multiple slots, Stingray will use the first slot that has a card inserted and is capable of logins and RSA decryption.

To prevent using up potentially limited PIN attempts, if the login fails with a PIN error, Stingray will not try to log in again until the SSL hardware settings are changed (e.g. the PIN is changed).

ssld!accel

This key indicates whether the SSL hardware can perform RSA decryptions faster than the Stingray software. If so, Stingray will offload as many SSL operations as possible to the hardware, falling back to software when the hardware is too busy. The default behavior is to only use the hardware when the relevant key requires it. If you have secure keys of this kind (keys stored on secure hardware), we recommend that you leave this set to No, to prevent SSL operations that do not need the hardware from using up all the hardware's capacity, leaving it unavailable for use with keys that require it.

ssld!failure_count

This setting is necessary because after SSL hardware has suffered a power failure or other reboot, previously-established sessions are not guaranteed to be usable. Therefore, if the hardware returns this many failures in a row, the session will be treated as unusable and Stingray will attempt to log into the hardware again. If the hardware has not yet become available again, the login will fail; Stingray will retry once per minute (if there is a PIN error, it will stop trying). Email alerts will be sent when SSL hardware becomes unavailable, and when it becomes usable again.

Logging

These settings control how system events and virtual server access are logged.

errlog

The file to log event messages to.

errlevel

The minimum severity of events/alerts that should be logged to disk. ERR_INFO will log all events; a higher severity setting will log fewer events. More fine-grained control can be achieved using events and actions on the System > Alerting page.

log!time

This setting specifies the minimum time between log messages for log intensive features such as Service Level Monitoring.

log!rate

This setting specifies the maximum number of connection errors that will be logged in the event log per second.
Connection errors are reported by a virtual server if a client or server connection encounters a problem.

Connection error logging can be enabled for a virtual server using log!server_connection_failures or log!client_connection_failures setting in the Virtual Server > Connection Management page.

log!flushtime

How long to wait before flushing the request log files for each virtual server

log!reopen

How long to wait before re-opening request log files, this ensures that log files will be recreated in the case of log rotation.

recent_conns_snapshot_size

The maximum number of connections each traffic manager process should show when viewing a snapshot on the Connections page. This value includes both currently active connections and saved connections. If set to 0 all active and saved connection will be displayed on the Connections page.

recent_conns

How many recently closed connections each traffic manager process should save. These saved connections will be shown alongside currently active connections when viewing the Connections page. You should set this value to 0 in a benchmarking or performance-critical environment.

recent_conns_retain_time

The amount of time for which snapshots will be retained on the Connections page.

gslb!verbose

Whether to write a message to the logs for every DNS query that is load balanced, showing the source IP address and the chosen datacenter.

Traffic Manager Fault Tolerance

These settings control how the traffic manager machines check and announce their connectivity, and detect network failures.

flipper!autofailback

When a traffic manager that is hosting Traffic IP addresses fails - for example if its network connection is lost or the software is stopped - it will drop its Traffic IPs and another traffic manager in the cluster will raise them. When the traffic manager comes back online it can either automatically raise the Traffic IPs that it had dropped or it can go into a 'pending' mode, where it will wait to be told when it should raise those Traffic IPs.

Setting the flipper!autofailback key to 'Yes' will result in the traffic manager automatically raising Traffic IPs when it comes online. Setting it to 'No' will cause the traffic manager to go into the pending state when it comes online.

When a traffic manager is in the pending state, a warning will be shown in the UI. The pending traffic manager can then be fully activated from the Diagnose page or the Traffic IP Groups page.

Should a traffic manager be in the pending state and all other machines in its cluster fail then the traffic manager will automatically come back online and take over all the Traffic IPs it is responsible for. A traffic manager will also come online automatically if it would not cause any disruption to services already running.

flipper!monitor_interval

Stingray periodically checks to see if it can contact other devices on the network. The result of this check is then announced to other traffic managers on a multicast address. The monitor_interval setting determines the amount of time between these checks. Decreasing the value of this setting will mean failures in the network are detected sooner, however the workload on the system will increase.

flipper!monitor_timeout

This setting determines how long Stingray should wait for a response when it has tried to contact one of the devices used to check connectivity. If a response is not received within this time then Stingray will assume it cannot contact the device. Decreasing this value will have the effect of allowing Stingray to detect failures sooner, however the reliability of the system will be reduced because slower connections might be incorrectly regarded as having failed.

flipper!heartbeat_method

In a cluster, each traffic manager must send out periodic healthcheck messages, to check that all software and network services are running.

With the 'multicast' heartbeats, these messages get sent using multicast network packets, which should traverse all network ports on all switches that the traffic managers are connected to. Multicast messages will only reach machines on the same subnet.

With 'unicast' heartbeats, directed UDP messages are sent to each traffic manager. Multicast messages are potentially more efficient, but may not work if the switches in your network do not properly handle multicast packets. Unicast messages will also reach machines on separate subnets, e.g. traffic managers in disparate data centers.

flipper!unicast_port

When using unicast heartbeat messages, the traffic manager must listen on a separate network port for the unicast messages. This port needs to be contactable from the other traffic managers.

flipper!arp_count

This setting determines the number of ARP packets that Stingray will send when an interface is raised. Although only one ARP request is needed to inform the network of the new interface, it is possible for ARP packets to get lost or to be missed by other devices on the network. To improve the reliability and speed of the broadcast, Stingray will by default send several ARP packets when an interface is raised.

flipper!frontend_check_addrs

Stingray will try to send 'ping' network packets to these addresses to help it discover if the external networking is OK. If it cannot reach these machines, Stingray will decide that its network connectivity is broken and will 'fail-over', letting the other traffic managers in the cluster take over.

If your Stingray setup does not require external connectivity, for example if it is part of an Intranet, then the external connectivity check can be disabled by setting this key to blank.

flipper!use_bindip

By default, Stingray will send the multicast messages it uses to announce its connectivity out over every network interface. By sending messages on every network interface the reliability of the system is increased: a failure on one network interface will not cause other traffic managers in the cluster to assume that this machine has failed.

If the use_bindip setting is set to 'Yes' then multicast messages will be sent and received on the management interface alone. This can be useful if your traffic managers communicate with each other on a separate network to that used by the main traffic, however the reliability of the system could be compromised as a result.

Connection Settings

These global settings control how Stingray manages connections to the nodes.

node_connection_attempts

If Stingray notices that this many connections to a back-end node have failed (without any intervening successful connections), then it will declare that back-end node as dead, and will stop sending it traffic.

node_fail_time

When a node has been marked as failed, Stingray will not send any traffic to it for a period of time. After this time has elapsed, Stingray will try to send some new data to the node to see if it has recovered.

This setting allows you to adjust the amount of time Stingray will wait before trying to send new data to the failed node. Stingray will keep retrying the node after this period of time until it has recovered.

trafficscript!variable_pool_use:

Stingray keeps track of which pools are in use, this allows it to show summaries of pool usage in the user interface and hide node errors for pools that aren't being used. However sometimes it is convenient to use variables in the 'pool.use' and 'pool.select' TrafficScript functions.

By enabling the setting Stingray will not be able to always accurately determine pool usage and some parts of the UI may not have accurate usage information.

Java Extensions

These settings control the setup of the Java Extensions to be used in Stingray.

java!enabled:

Enable this control to allow Stingray to use Java.

java!command:

The name of the Java command along with any execution parameters it may need.

It is possible to specify additional execution parameters here in order to use Java's remote debugging facility:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

The address=8000 section allows you to specify the port that the Java runner uses when listening for connections. This can be set to whatever you choose, however it is important to consider the security implications of using a port open to unauthorized use.

java!classpath:

Additional java paths or .jar files. Multiple paths should be separated with a ':' symbol.

java!lib:

This is the Java library directory for additional .jar archive files. The Java runner will load in classes from these .jar files in addition to those stored in Stingray's catalog.

java!max_conns:

The number of maximum Java connections allowed. New requests will be queued until the existing ones are completed. This number is treated on a per processor basis. This can help prevent Java from being overloaded under high traffic levels.

java!session_age:

The maximum age for Java's session persistence cookies.

Login and Security Settings

These settings alter login behaviour.

login_banner

A message displayed to anyone who attempts to log in to the Administration Server. It is presented to the user when they log in to the appliance using SSH, before they enter their password.

banner_accept

Whether the user is required to explicitly acknowledge the login_banner text when logging into the Administration Server.

post_login_banner

Text to be displayed on the appliance console after login.

uipage_banner

This is a message displayed at the top and bottom of each page in the Administration Server

max_login_attempts

The number of login failures permitted before a user account is suspended. It will be reactivated after the delay set in max_login_suspension_time and can be reactivated sooner from the Users > Local > Edit page or the Users > Suspended Users page.

max_login_external

Specifies whether externally authenticated (LDAP, RADIUS or TACACS+) users should be suspended after max_login_attempts login failures.

max_login_suspension_time

The length of time for which a user account is suspended after max_login_attempts login failures.

login_delay

The delay after a failed login before another login attempt can be made.

track_unknown_users

Whether to remember login attempts for usernames which have never successfully logged in. This option affects the information about failed logins presented after login, and the account suspension feature, but not the audit log. This option should not be enabled if your Admin Server is accessible from the public Internet, to avoid problems with large numbers of login attempts with different usernames.

bootloader_password

This setting changes or disables bootloader password protection for the appliance. When set, the password will be required to choose previous versions in the boot menu.When set, the password will be required to choose anything but the default option in the boot menu and also to edit any of the boot menu entries.

Aptimizer

These settings control how the Aptimizer process is disabled if repeated failures occur. Aptimizer must parse and understand large quantities of user-defined data, and so is more susceptible to failure in exceptional circumstances than other traffic manager components. Aptimizer will automatically be disabled if there are frequent failures, and the traffic manager will fall back to serving unoptimized data.

Most users will not have to use these settings. If you do find that Aptimizer fails frequently, contact your support provider.

aptimizer!watchdog_limit

The maximum number of times the Aptimizer sub-process will be started or restarted within the interval defined by the aptimizer!watchdog_interval setting. If the process fails this many times on one Traffic Manager, Aptimizer will be disabled on all Traffic Managers in the cluster, and it must be restarted manually from the Diagnose page.

If this limit is set to zero, Aptimizer will never be disabled.

aptimizer!watchdog_interval

The period of time (in seconds) after which a previous failure will no longer count towards the limit set by aptimizer!watchdog_limit.

Other Settings

These settings control other traffic manager properties.

control_allow

This setting is used to restrict access to Stingray's administration port. Remote machines can connect to this port to configure Stingray. (this is not the same as web-based interface). If you are using just one traffic manager, then this should be set to '127.0.0.1' to restrict access to the local machine.

trafficscript!data_size

The maximum amount of memory available to store TrafficScript data.set() information. This can be specified as a percentage of system RAM, '5%' for example; or an absolute size such as '200MB'.

If the limit is exceeded data.set() will fail and an error will be reported.

trafficscript!data_local_size

The maximum amount of memory available to store TrafficScript data.local.set() information. This can be specified as a percentage of system RAM, '5%' for example; or an absolute size such as '200MB'. Note that this is the total amount of memory used by all child processes for data.local information. Therefore, since each child process has its own dedicated data.local storage, each child will only have trafficscript!data_local_size / num_children bytes of memory for this purpose.

If the limit is exceeded data.local.set() will fail and an error will be reported.

If you set the limit below the current usage all data previously stored with data.local.set() will be flushed.

trafficscript!regex_match_limit

The maximum number of ways TrafficScript will attempt to match a regular expression at each position in the subject string, before it aborts the rule and reports a TrafficScript error.

This limits the amount of backtracking performed. A bigger number means that TrafficScript might take longer running a regular expression, and consume more CPU time, before giving up. The limit applies to all TrafficScript regular expression matching (currently: string.regexmatch, string.regexsub, and array.filter).

Should a regex_match_limit error occur, it may be that your regular expression has exceeded the maximum amount of backtracking allowed under the present limit. You should increase the regex_match_limit or consider revising your regular expression. If you suspect that traffic manager performance is suffering because of slow regular expressions, you can decrease trafficscript!regex_match_warn_perc (see below). This will enable warnings to help you discover which regular expressions are likely to be responsible.

This limit is used as the match_limit parameter to the PCRE regular expression library. For further detail, see the PCRE documentation at http://www.pcre.org/pcre.txt. Note: a value of zero does not disable the limit, but sets it extremely high (10 million).

trafficscript!regex_match_warn_perc

The percentage of trafficscript!regex_match_limit (see above) at which TrafficScript reports a performance warning.

  • TrafficScript regular expressions that do not reach this percentage of the limit operate correctly.
  • TrafficScript regular expressions that exceed this percentage, but do not exceed the full limit, operate correctly, and additionally report a performance warning.
  • TrafficScript regular expressions that exceed the full limit are aborted and report an error.

For example, if trafficscript!regex_match_limit is set to 1000, and trafficscript!regex_match_warn_perc is set to 20, then a regular expression that requires 200 PCRE match operations (20% of 1000) will operate correctly, and additionally report a performance warning.

By setting a low percentage (for example: 5), you can receive early warning of regular expressions that may be causing performance degradation, without disrupting correct operation.

If you do not require early warnings, use a setting of 100, which means that a warning will only be reported when the full limit is hit.

Restore Defaults

Restoring the defaults will revert all the changes you have made to the global settings.

This can be a quick way to discover which values have been changed.

Restore Defaults

Restoring the defaults will revert all the changes you have made to the global settings.

This can be a quick way to discover which values have been changed.

Two types of location are listed on this page: one for configuration sets and another for GLB Services. New locations can be added using the section provided; select the type and, in the case of configuration locations, an existing template location upon which your new entry will be based. This Based On setting provides an inheritance mechanism which means the location-specific settings enabled for the template location are inherited by the new location entry.

If you want to use a location for the purposes of configuration grouping as well as global load balancing, you have to create it twice (with different names).

To use configuration locations, multi-site cluster management must be enabled on the System > Traffic Managers page.

Configuration Locations

A configuration location is a definable object to enable grouping of one or more traffic managers that are situated in the same place. Configuration can then be made on a location-specific basis, and hence only applicable to those traffic managers present at that location.

GLB locations

GLB locations are used by GLB Services to identify where the services are that they are loadbalancing across.


This page displays the configuration for a location and allows you to edit its basic settings. Both configuration and GLB Service locations are handled by this page.

Settings

This section contains name, position and type settings for your location. Unless this is the first location entry for your system, you can also specify the location it is to be based on.

The position is a multi-choice setting. For a Configuration Location, the position is used to plot the location on the Activity > World Map page. For a GLB Location, the position influences the distribution of traffic when a geographic load balancing method is used.

Select from one of the following:

No position
The default setting
By Country
Select a country name from the associated drop-down list
By coordinates
provide the specific degrees of latitude and longitude for the location
From the map
Here you can visually select a location by dragging the cross-hairs to a position on the map provided. This is a reduced version of the Activity > World Map page. The same drag/drop/zoom controls apply.

Delete Location

You can only delete locations that are not currently in use.


A Global Load Balancing (GLB) service represents the configuration that you want to use for load balancing a set of DNS domains. A GLB service is based on a set of Fully Qualified Domain Names and IP addresses. When you create a new service, you tell the traffic manager which IP addresses are hosted at each location for each domain name.

This page lists all the GLB Services you have created. Each service shows the set of domains it is load balancing and the locations covered. Other settings seen here include the algorithm being used and the Time-To-Live (TTL) value.

GLB Services rely on you having previously set up GLB-type locations. You will be unable to add a new GLB Service if you have no locations defined. Please refer to the Locations page for more details on setting up suitable locations.

This page displays the configuration for a Global Load Balancing (GLB) Service and allows you to edit its basic settings.

At the top of the page is some basic information on this service, including which domains it is balancing. GLB services are used by associating them with a DNS-type Virtual Server. Please refer to Editing a Virtual Server's Settings for more details.

Further GLB Service settings are split into categories to make them easier to navigate. Each of the folding sections provides a quick summary of the configuration for that category and leads through to a more detailed page where all of the category's settings can be edited.

Basic Settings

This section allows you to rename your service and change its basic properties.

Name

You can rename a GLB service by editing this field. If you rename a service, virtual servers using it will be updated to refer to the new name.

A GLB Service name should be a short description. It cannot contain reserved characters like '!', '.', '/' or '\'.

Enabled
This setting allows you to maintain the configuration for a GLB Service without it being in active use. Only enabled services will be used by the virtual servers they are associated with.
Domains

Here you provide a list of every Fully Qualified Domain Name that you wish to balance globally. Extra domains can be added to the service using the text box provided, and existing domains removed by clicking the Remove checkbox alongside the corresponding entry.

Domains may contain a '*' wildcard character, e.g. *.foo.com.

Click Update to save any changes to these settings.


The Domain Name System Security Extensions (DNSSEC) suite of specifications provide a set of security and authentication extensions to DNS.

This page provides the facility to allow Stingray to alter DNSSEC authenticated responses by setting up associations between signature domains and DNSSEC Private Keys. You can add one or more associations by entering a signature domain in the box provided and clicking the 'plus' symbol. The private key can then be selected from the drop-down box.

Click Update to confirm the association.

You can associate multiple keys to one domain, and an individual key can be used to authenticate many domains.

DNSSEC private keys can be added by clicking the Manage DNSSEC private keys link, which takes you to the Catalogs > SSL > DNSSEC Keys page.


On this page you can add and remove pre-defined locations to your service. The Add Location section allows you to add new locations, and each added location contains a link to remove it. Click on the View Location link to view the details page for this location.

The traffic manager will load-balance clients between the locations specified on this page according to the load-balancing settings defined on the Catalogs > GLB Services > Load Balancing page.

To direct clients to the chosen location, the traffic manager will alter DNS responses from the pool to which this GLB service is assigned. The altered DNS responses will contain the IP addresses associated only with the chosen location. The IP addresses associated with each location can be configured on this page.

Note that if a particular DNS response does not contain any of the IP addresses associated with locations on this page then it will be returned unaltered.

Within each added location, you can configure the following settings:

Draining
You may wish to completely stop sending traffic to a location. A practical need for doing so would be if you are physically relocating your equipment from one location to another. Another example would be upgrading the backup power system and you need to disconnect your UPS, generator, inverter and/or batteries.
Local IPs
In order for Stingray to manipulate the answers it sends to a client, it must know which IP addresses belong to which locations. Here you may enter a list or a range of IP addresses for each. These IP addresses correspond to the IP addresses that your DNS servers will return in a round-robin fashion when queried for the domains you are managing.
Monitors

Here you can select which monitors should be used in this location. Each monitor performs one test, and multiple monitors may be configured for each location. The monitor tests are performed at configured intervals against a specific machine. When a monitor has exceeded its limit of consecutive failures, the service in a particular data center will be flagged as dead; and it will be filtered out of any subsequent DNS responses.

To create a monitor that can be used with a GLB service, visit the Monitors Catalog page and create a new monitor with a Pool/GLB scope, specifying the machine you would like it to monitor.

For more information on creating a monitor, please see the Catalogs > Monitors page.


Several load balancing methods are available.

Note that the 'Disaster Recovery' variant of Stingray Traffic Manager only supports the active-passive load-balancing method.

The load balancing methods are:

Load
Distributes traffic based on the current load to each location. The decision of which location to send the client to is based purely on the load of each location; which it discovers via health monitors or the external SOAP API.
Geo
Distributes traffic based solely on the geographic location of each client.
Round Robin
Distributes traffic by assigning each request to a new location in turn. Over a period of time, all locations will receive the same number of requests.
Adaptive
Distribute traffic based on both the load and geographic location. If you find that one of your locations is receiving most of the traffic (to the point where it is being overloaded) then you may wish to use this load balancing algorithm. This will help to achieve the best balance between latency due to distance and latency due to load.
  • Geo Effect: You may fine tune how much effect the geographic location has when deciding which location a client should be sent to.
Weighted Random
Distributes traffic in a random way, but according to a weighted policy defined by individual location weights. More traffic will be assigned to locations with a greater 'weight'.
  • Location Weights: Over a period of time, locations will receive a number of requests that increases in proportion to their weight.
Active-Passive
If you provide a service which is dependent on state information (such as a shopping cart site) and you are not replicating your databases globally in real time, you may wish to run your sites in an active-passive configuration. This algorithm will ensure that DNS records are only sent for one location at a time.
  • Failover Order: If you enable Active-Passive mode, you will be able to choose which location is active and which ones are passive. If you have more than two locations, you may specify the order in which the locations fail over. The order is indicated from top-to-bottom. To promote a location, simply drag it to the desired place within the stack.
  • Automatic Failback: You may also decide what happens when a higher-priority location recovers after a failure. If Automatic Failback is enabled, all users will be directed to the higher-priority location. It will become active. If Automatic Failback is not enabled, users will continue to be directed to the same location until you explicitly configure Stingray Traffic Manager to reactivate the higher priority location using the setting in the user interface. This behavior is desirable in cases where the recovered location needs to synchronize state or content before it can be used.

TrafficScript rules can be applied to a GLB Service to give sophisticated traffic management functionality. Please refer to the TrafficScript Guide for further details of TrafficScript and its capabilities.

Rules are stored centrally in the Rules Catalog, and each GLB Service refers to the copy in the catalog. This way the same rule may be used by several services at the same time.

Note that you cannot use functions that are incompatible with the DNS protocol (such as http.*).

Rules

This is the list of rules currently attached to your GLB Service. If you rules catalog is empty, you can't do much here. To add a rule click the manage Rules in Catalog link.

To add a new rule, select the rule name from the drop-down list and click Add Rule.


You may need more visibility of the DNS requests that are flowing into your Stingray cluster. Request Logging lets you log each request into a specified file for later analysis.

To enable logging, set the log!enabled config key to yes and click Update.

log!filename
The location on the local file system where the request logs for this GLB Service should be located.
log!format
The string format of the request log. Information about each request may be accessed via macros escaped by '%'. The available macros are listed in the user interface.

TTL (Time To Live)
If you want to modify the TTL value in each response, you may do so here. The TTL value controls how long clients cache the DNS response before attempting to re-resolve it. The TTL values used by DNS servers are typically too long for GLB purposes (in the order of hours or days). To get a rapid failover if a location fails, clients need to re-resolve the DNS entry frequently, so a value of 30-60 seconds is appropriate.

The catalogs are repositories for configuration objects that can be applied to your services.

Locations Catalog

This catalog contains your locations, used for configuration sets and GLB Services.

GLB Services

GLB Services are used for load balancing between geographic locations.

Rules Catalog

This catalog contains traffic inspection & rewriting rules that you can apply to a virtual server.

Java Extensions

This catalog contains a list of the Java Extensions that you can apply to a virtual server. Extensions can be used in TrafficScript rules, offering additional features and a greater flexibility.

Aptimizer Catalogs

This catalog contains Application Scopes and Aptimizer Profiles used to optimize web content.

Monitors Catalog

This catalog contains node monitors that you can apply to a pool.

SSL Catalogs

These catalogs contain the resources (certificates, certificate authorities, CRLs) required to manage an SSL-encrypted service.

Authenticators Catalog

This catalog contains external authenticators for validation of users' credentials using TrafficScript.

Service Protection Classes

This Catalog contains the service protection classes available for use by the virtual servers.

Session Persistence Classes

This Catalog contains the session persistence classes that you can apply to your pools.

Bandwidth Classes

This Catalog contains the bandwidth classes available for use by the virtual servers.

Service Level Monitoring Classes

This Catalog contains the service level monitoring classes available for use by the virtual servers.

Rate Shaping Classes

This Catalog contains the rate shaping classes available for use by the virtual servers.

Extra files

This Catalog allows programs and extra data files to be uploaded. Extra files are divided into the following categories:

Action Programs
Programs that can be executed by external program actions.
Monitor Programs
Programs that can be executed by external program monitors.
Miscellaneous Files
Files that can be read from TrafficScript rules using the resource.get() function and error files. Error files can be used to show user-friendly information, for example a text file stating that a given service is unavailable.

Bandwidth management, Service level monitoring and Rate Shaping are not available on all configurations.


This is the repository for traffic inspection rules that you can apply to your virtual servers.

Rules

Rules are displayed in alphabetical order. You can unfold a rule to view its full TrafficScript source. Also shown is a list of virtual servers currently using the rule, and a list of virtual servers which have the rule attached to them but disabled (if there are any).

TrafficScript is not available on all configurations.


TrafficScript is a license-controlled feature and is not available on all configurations. Please contact your support provider if you require any further information.

Editing a Rule

To make changes to the name, descriptive notes or TrafficScript of a rule, edit the appropriate value(s) and click Update.

TrafficScript Editor

In most modern browsers the TrafficScript editor provides two advanced features to assist users in writing code and improving readability:

It is also possible to resize the edit area to a size of your choosing by dragging the right hand side, the bottom edge or the bottom-right corner. The new size will be preserved between sessions.

Local users can choose to disable the advanced editor features and just use simple text editing by disabling the user!admin!trafficscript_editor setting on the user edit page.

Syntax Checking

The Check Syntax button will cause your rules to be parsed for errors.

For information on the functions available in TrafficScript, see the TrafficScript Guide.

Copying a Rule

The Copy Rule button will copy the current rule, give it a new name, and open it for editing.

Deleting a Rule

To delete a rule, tick the Confirm checkbox and press the Delete Rule button. The rule will be removed from all virtual servers using it, and deleted from the system.


General Notes

The RuleBuilder is a tool to help generate simple rules quickly and effectively. You can add multiple conditions and actions to a rule with ease, and fine tune the various arguments and options to your specific requirements. At any time you can save the state of the rule as you see it on screen by clicking Update.

It is also a useful tool when learning TrafficScript as you may preview, at any time, the code a RuleBuilder rule would generate should you convert it to TrafficScript.

TrafficScript is a license-controlled feature and is not available on all configurations. Please contact your support provider if you require any further information.

You will notice that the list of actions and conditions that can be added to a rule are split into sections Requests and Responses, Requests Only and Responses Only. This is done to highlight that certain actions or conditions may only be used in request or response rules, or in fact may be used in both. A good example of this is Add Response Header, where it is clear that it will only have a useful effect when used in a response rule. You can not mix items which are Request Only and Response Only in the same RuleBuilder rule.

For information on the actions and conditions that can be added to a rule, see the RuleBuilder Reference.

Editing the Name and Notes

To make changes to the name or descriptive notes of a rule, edit the appropriate value(s) and click Update.

Adding and Editing Conditions

Conditions determine whether a rule's actions should be executed. It is possible to supply no conditions, and in this case the actions in the rule will always be executed. Conditions are based on connection values and tests applied to them.

You can select whether you wish 'Any' or 'All' of the set conditions to be met before executing the rule's actions.

To add a condition, do the following:

You can remove a condition by clicking the icon to the right of its definition.

Adding and Editing Actions

Actions perform tasks such as modifying the connection, recording information or performing routing decisions. These tasks can be either terminal or non-terminal, where terminal actions halt the execution of the rule e.g. choosing a pool to route the data to.

The terminal actions are Drop Connection, Choose Pool and HTTP Redirect; only one of which can be executed before exiting so it is only possible to add one to a rule. It is not possible to create a rule with no actions as such a rule would not do anything. If you do not supply any actions you will be reminded to do so.

To add an action, do the following:

You can remove an action by clicking the icon to the right of its definition.

Deleting a Rule

To delete a rule, tick the confirmation checkbox and press the Delete Rule button. The rule will be removed from all virtual servers or service protection classes using it, and deleted from the system.

Converting a Rule to TrafficScript

Should you wish to convert a rule into TrafficScript you can do so by clicking Convert Rule. By converting the rule you lose the ability to edit it using the RuleBuilder, however you gain the full power of the TrafficScript language.

If you do not want to convert the rule into TrafficScript but you would like to see the code it would generate you can do so by clicking on the Preview Rule as TrafficScript button or link. This will open a new window which will display the rule as it would be if it were converted.

Below is an example rule and the TrafficScript it would generate;

Example Rule

Generated TrafficScript


if( http.getVersion() == "1.1"
        && string.contains( http.getQueryString(), "username" )
        && http.getMethod() == "GET" ){

        http.setheader( "Host", "www.acme.com" );

        pool.use( "Web" );

}
Converting to TrafficScript may not be available in all configurations.

Comparison Operator Descriptions

Most of the comparison operators are very simple however the more complex options are described below.

matches regex & does not match regex

When comparing strings this means that the expression you enter will be evaluated as a regular expression which matches or does not match the value you have selected to test.

is a member of & is not a member of

When comparing IP addresses this means that the IP address you have chosen to test will be checked to see if it is a member of or not a member of the CIDR IP subnet that you have supplied as an expression.

Special variables

There are several special variables that can be included in the text boxes for RuleBuilder which are expanded to TrafficScript functions. These allow the generation of more dynamic rules, with extra flexibility.

For example, if you create a rule that sets the HTTP header 'X-Forwarded-For' to the value '%REMOTE_IP%', then the header will be set to the IP address of the client connecting to the traffic manager.

The complete set of special variables are listed below - see the links to the TrafficScript documentation for details of what the function does.


General Notes

Java Extensions are modules that extend the functionality of Stingray. Java Extensions can be developed using the Java Servlet API. For more information, see the Java Development Guide. For detailed reference information, see the Java API Documentation.

Before using Java, you may need to adjust some of the Global Settings that configure how Java is started. You will also need to download the JAR files for the Java Servlet API and the Stingray Java Extensions API.

Java Extensions catalog

This is a repository of Java Extensions that you can apply to your virtual Servers. Click on the name of one of the extensions to edit its initialization parameters.

Java Libraries & Data catalog

This is a repository of additional Java classes, .jar libraries and data files that may be used by the Java Extensions.

Uploading a Java Extension

To upload a Java Extension, click on the 'Browse' button and select the Java .class or .jar file to upload. Other files may also be uploaded, e.g. data or config files that the Extension may use.

Java Extensions are run from TrafficScript rules. For convenience, whenever a new Java Extension is uploaded, Stingray can create a new TrafficScript rule that runs the Extension. This rule will be given the same name as the Java class. Once the rule is created, you can edit the rule just as any TrafficScript code.


Initialization parameters

These are parameters that are passed to the Java Extension when it is run by the TrafficScript rule. These parameters can be used to specify configuration details, instead of 'hard coding' these parameters in the Java code. For example, a parameter could specify the hostname of a database that the Java Extension uses to authenticate users.

Initialization parameters can be read from Java by using the following code:

ServletConfig config = getServletConfig();
String db = config.getInitParameter( "database_name" );


This is the repository for Aptimizer Scopes and Profiles, both of which can be applied to a virtual server to optimize web content served through it.

Application Scopes catalog

An Application Scope object is used to define a collection of URLs that match a specific web site or application hosted by a virtual server.

Aptimizer Profiles catalog

The Aptimizer Profiles catalog contains a list of optimization profiles that can be applied to websites and web applications to enable automatic content optimization.


An Application Scope object is used to define a collection of URLs that match a specific web site or application hosted by a virtual server. You can find these on the Catalogs > Aptimizer > Application Scopes catalog page.

It may be the case that multiple applications are hosted through a particular virtual server, differentiated by the URL in the request. In this case you would set up a Scope entry for each combination of hostname and root path that identify an application, and apply appropriate mappings to optimization profiles on the Aptimizer Settings page. Requests that match an Application Scope will have the associated Aptimizer Profile applied.

Several hostnames can be included in one Scope. However, all these names should be aliases for the same host, and it should be possible to fetch the same resources using any of them. If an alternate hostname is used to serve content from a Content Delivery Network, then that CDN must proxy the origin host so that content passes through the same Application Scope again within Traffic Manager.

To optimize resources hosted on a different host, such as an external media host, use an Aptimizer Profile which includes a URL rule with Applies to externally hosted resources enabled. See Editing an Aptimizer profile.

When a request is received through a virtual server, a match is sought to the most-specific URL within the Scope mappings defined in the Aptimizer Settings. If Stingray finds a match, it applies the appropriate optimization Profile defined in the mapping. Applying an Application Scope that specifies a hostname to a virtual server that does not host an application by that name may cause requests to fail with a 502 status — if you see this HTTP status, check that the Application Scope hostnames are logically grouped by the application they represent.

A built-in scope is automatically provided, entitled Any hostname or path, that can be used where no specific hostname and/or path identification is required within the web application. The hostname field is blank, and the root path is set to '/' accordingly.

Create a new application scope

You can add a new application scope by entering the new scope name in the box provided. You should also provide the root path of the application to be optimized, and the list of one or more hostname aliases to limit this acceleration scope to.

You will then be taken to the scope edit page, where you can make any necessary changes.


The settings of application scope can be edited here.

Basic Settings

Name
The descriptive name for this scope
Hostnames
The primary hostname and any aliases used by this application. These should be aliases for the same host, and it should be possible to fetch the same resources using any of them, as described in the Application Scopes Catalog.
Root path
The root path of the application to be optimized, for the list of hostnames provided.

Apply Changes

Click Update to save any changes to these settings.

Save as new application scope

Enter a new name in the box provided and click the Save button to create a copy of this scope.

Delete application scope

To delete a scope, check the Confirm box and then click the Delete button.


The Aptimizer Profiles catalog contains a list of profiles that can be applied to websites and web applications to enable automatic content optimization.

Built-in optimization profiles

Stingray provides a set of built-in fixed profiles that provide pre-defined optimization settings suitable for most situations:

SharePoint 2007
Optimization settings tuned for acceleration and compatibility with SharePoint 2007 internet and intranet sites. Includes resource URL versioning, durable caching, CSS inlining, CSS minification, background image inlining, JavaScript minification, compression, image shrinking and metadata removal, and advanced JavaScript compatibility.
SharePoint 2010
Optimization settings tuned for acceleration and compatibility with SharePoint 2010 internet and intranet sites. Includes resource URL versioning, durable caching, CSS inlining, CSS minification, background image inlining, JavaScript minification, compression, image shrinking and metadata removal, advanced JavaScript compatibility, and SharePoint ribbon optimization.
SharePoint 2013
Optimization settings tuned for acceleration and compatibility with SharePoint 2013 internet and intranet sites. Includes resource URL versioning, durable caching, CSS inlining, CSS minification, background image inlining, JavaScript minification, compression, image shrinking and metadata removal, advanced JavaScript compatibility, and SharePoint ribbon optimization.
Other web application
Basic optimization settings appropriate for safely accelerating most web applications. Includes CSS inlining, CSS minification, background image inlining, JavaScript minification, compression, and image shrinking and metadata removal. You can use a copy of this profile as a template to enable more advanced content optimization techniques appropriate for the web application that is being optimized (see Creating a custom profile below).
Basic (deprecated)
This profile has been superseded by the 'Other web application' profile.
Advanced (deprecated)
This profile has been superseded by the 'Other web application' profile.

Creating a custom profile

If these built-in profiles do not offer the desired level of optimization suitable for your needs, you can opt to create a custom profile.

Custom profiles can be created in the Create a new Aptimizer Profile section using one of the built-in profiles as a template. Select the desired template profile from the drop-down list and click on the Create Aptimizer Profile button.

Built-in profiles can also be duplicated to create new custom profiles using the Save As option on the profile Edit page.


Basic Settings

Name
The descriptive name for this profile
mode

Aptimizer can run in one of three optimization modes:

Off
Acceleration is disabled, but requests for Aptimizer resources are served.
Stealth
Acceleration is controlled by a cookie. The query string command: ?aptimizer=on sets the cookie to enable acceleration; ?aptimizer=off clears the cookie
On
Acceleration is enabled for all requests.

show_info_bar
You can elect to show request information for each web page that is passed through an Aptimizer Profile using this setting. If this is set to Yes and acceleration is currently active, all pages in this session will show a status bar which includes controls to provide information specific for that request.

Background Optimization

Optimizing complex resources, such as large image sets or CSS files with multiple nested imports, can be a time-consuming process. Although Aptimizer will do this only once for a given resource, it might result in the client that first requires this optimized resource having to wait for it to be completed.

This section allows you to configure Aptimizer to complete optimizations in the background, serving the original unoptimized server content to all clients that request it until the optimized data is ready.

Resources, such as combined image sets, will be automatically cached after they are optimized. Web pages will be cached only if the virtual server's webcache!enabled setting is Yes, however if all the resources on the page have already been optimized then the optimized page can be delivered quickly.

There are two ways of deciding whether to optimize resources in the background: background_after and background_on_additional_resources. The first method ensures that a client will wait no longer than the specified time to see the requested web page, and the second makes an informed decision about when to optimize in the background based on the complexity of the resource being optimized.

background_after
Specifies the number of milliseconds after which the optimization will be put into the background and the original server content will be served to the client.

Note that some resources, such as JavaScript files, must always be served optimized. As such, they cannot be optimized in the background using this setting.

background_on_additional_resource
When a page, or a resource such as a CSS document with nested imports, requires Aptimizer to fetch additional resources to complete the optimization process, do the optimization in the background.
Note, resources cannot be optimized in the background if the site being optimized is protected by NTLM authentication.

The Acceleration Settings dialog

Aptimizer behavior can be customized by modifying the acceleration settings. Custom rules provide granular control over behavior for specific URL locations.

The dialog box in this section contains controls and rules to handle optimization of different content types within your web application. It is split into two main parts:

A default settings rule is provided for each Acceleration Profile that cannot be removed. This allows you to define the default behavior of the profile and configure the fall-back values for each of the property tabs.

URL Rules

New rules can be added to further define optimization behaviour and to override the default properties based on a URL (click on Add URL rule).

These newly added rules can be ordered according to priority or desired effect by clicking on the up or down arrows to the right of each rule bar. They can be removed altogether by clicking the delete button to the right.

Overriding default behavior

With the exception of the Rule Behavior tab, each rule property in the lower part of the Acceleration Settings dialog contains an Override checkbox. This is used to activate the controls contained on the tab, in order to override the default settings when this rule is matched. Leaving the checkbox un-selected means that the defaults remain in effect.

Rule properties

Each property pertains to content that constitutes a typical web application, such as CSS, Javascript and images. A separate tab is provided for each group of related optimization settings.

The Rule behavior tab

Each URL rule added to the profile has a Rule Behavior tab. This tab contains the basic request-matching characteristic of the rule, and allows you to provide a suitably-matching description.

Rule description
A textual description of the current rule, automatically assembled from the basic rule behavior settings contained in this tab. For example, changes to the URL test string or Rule mode will be automatically reflected in the descriptive text in this field. It is possible to override this text with your own description, however no further automatic updates will be made.

To reset the description back to the default auto-generated string, click the reset button.
Rule mode
Aptimizer can be set to accelerate or exclude all pages and resources identified by this rule. Accelerate mode is the default, and performs the desired optimization defined within the rule properties on a matching request. The other options are to set the rule to exclude optimization for pages or resources that match the URL, or to strip out resource references where a match is encountered.
URL test
URL rules only apply to requests that match the specified text. The text is compared with the full URL including the hostname if the Match external resources box is checked, otherwise it is compared only with the URL path. You can specify a substring that must be contained in the URL, or a wildcard or regular expression that must match the entire URL.
Applies to externally hosted resources
This setting allows you match against resources held external to the web application. If this is selected the rule will only match requests for hosts that are not included in the Application Scope, and the string contained in the URL test field will be matched against the hostname and path contained in the request. For example, you may wish to exclude media files on your web page that are included from an external media hosting website. If this is the case, you can select this option and specify a wild-carded string in the URL test field that includes the name of the hosting site in addition to the URL path of the media files you are interested in.
Rule chaining
The default behavior in any given situation is for each request to pass through the list of URL rules and stop when a match is found. No further URL rules are tested.

This stop-when-matched behavior can be overridden by selecting the Allow settings for this rule to chain to other rules checkbox within a URL rule. If enabled, a matching request will not stop at that URL rule. Instead it will continue on to find a second rule match in that logical block (the list of URL rules at the same hierarchical level).

Note, however, that this setting only remains in effect until a further match is found. At that point, if the second matching rule does not also have chaining enabled, the request will not attempt to match any further rules. If you wished to have all URL rules tested throughout your profile, regardless of how many matches occur, you would need to enable chaining on each of them.

The CSS tab

CSS and Stylesheet optimization

None
Style sheets will remain in their original form wherever they appear.
Optimize CSS Content
Style sheet blocks in the page and in external style sheets will have all redundant whitespace and comments removed.
...and combine consecutive stylesheets
Style sheets that appear as consecutive references (i.e. without inline style blocks or excluded style sheet links between) will be combined and each combined reference inserted to the location where the first style sheet in a set appears in the document.
...and combine all stylesheets
All style sheets will be combined, no matter where they appear in the page. The new combined reference will be inserted at the top of the head section of the document.

CSS background image optimization
The maximum allowable size (in bytes) of base64 encoded data to be inlined using data:uri notation or a MHTML reference. Images that exceed this limit will remain as URLs.

The JavaScript tab

JavaScript optimization

Enabled
Script files will have all redundant whitespace and comments removed.
Disabled
Script files will remain in their original form.

The Images tab

Combine images

Enabled
Images that appear as <img> tags in the HTML will be combined into an image sprite according to the image format.
Disabled
Images that appear as <img> tags in the HTML will not be combined into image sprites.

Shrink images
Images will be shrunk where possible, removing unnecessary information such as metadata, redundant color information and in the case of JPEG images, reducing the quality to reduce the size of the files.

If an image appears on a web page in BMP format, it will automatically be converted to JPEG format by Stingray to reduce its size. This can be prevented by excluding the image from processing with a rule.
Resample JPEG quality
The percentage quality level to resample JPEG images to (0-100). If retaining the quality of your JPEG images is paramount, then set this value to 100.

The default is 85.

The Caching tab

Version resource URLs

Enabled
URLs at this location will be versioned by appending a query string parameter that is a hash of the contents of the file. The cache expiry for versioned URLs is set to 1 year.
Disabled
URLs will be left unaltered and clients will cache the item for the full Cache on browser interval before rechecking.

Mark resources as cacheable by intermediary proxies

Enabled
Resources that are cacheable at this location will be marked with the Cache-Control public header which allows them to be cached by intermediary proxy servers.
Disabled
Resources that are cacheable will be marked with the Cache-Control private header to prevent them from being cached by intermediary proxy servers.

Optimize and cache resources

Enabled
If a resource such as an image or CSS stylesheet is requested by its original URL, enabling this option will cause Aptimizer to optimize and cache the resource before returning it to the client. This can be useful if, for example, your site contains JavaScript that fetches images or other resources from your server after the page has loaded.
Disabled
Directly requested resources are returned un-optimized and will not be cached by the traffic manager.

Cache on browser
The duration, in seconds, that resources will be cached on the client's browser before expiring. This is used as a sliding expiry to set the Expires header, meaning the client will cache the file for the specified number of seconds from when it receives it.
Background recheck
The time, in seconds, after which a resource that is in the server cache will be marked for a recheck. When a resource that is marked this way is requested, the existing version in cache will be returned immediately, while a background task refreshes the cached version if it has been modified.

The Hostname rewrite tab

URL hostname rewriting
Relocates resources from the current domain onto the specified host or URL root by rewriting all matching URLs. This can be specified as a single hostname (e.g. cdn.example.com) or a full root URL with optional scheme and path components (e.g. https://cdn.example.com/images).

Apply Changes

Click Update to save any changes to these settings.

Save as new profile

Enter a new name in the box provided and click the Save button to create a copy of this profile.

Delete profile

To delete a profile, check the Confirm box and then click the Delete button.


Monitors watch the nodes in a pool, and inform Stingray if the nodes are functioning correctly. They work by sending small requests that expect a set reply. If they don't receive the reply they want, the test fails and Stingray is notified.

A monitor sending test requests will increase the load on a pool, albeit by a small amount. You should ensure that your back-end servers can handle the traffic produced by the monitors. You can alter the frequency of the monitors, to avoid generating excessive load.

Monitors fall into two categories: node and pool.

Stingray contains a number of preset monitors. Some of these deal with generic TCP client-first or server-first protocols, and others are protocol-specific. They are:

Client First

This is a monitor based on the TCP transaction monitor. It will send some data to the node, and match the response against the supplied regular expression. In order to use it, the data to send (the write_string) must be configured.

Connect

This performs a TCP connect to the node. Its purpose is to ensure that a server is listening on the port, and will accept traffic. This monitor can cause some programs (such as exim) to output errors; in this case a more protocol specific monitor should be used.

DNS

This is an example of a program monitor. It will run a program that makes a DNS request to the node, and validate the address returned.

FTP

This monitor is based on the TCP transaction monitor. It will make a simple FTP connection, and check that the server is responding correctly. It only checks that the banner is returned by the server, and does not authenticate.

Full HTTP & HTTPS

This monitor can be used to perform HTTP requests. The host header, url and authorization can all be configured. The response return code is matched against the "status_regex": for instance, if you are expecting a 200 return code, the "status_regex" should be "^200$".

POP

This monitor is based on the TCP transaction monitor. It will make an initial connection to the node, and check that the correct POP banner is returned.

Ping

The ping monitor will perform ping requests to the machine. It will fail if no response is received.

RTSP

The RTSP monitor sends a DESCRIBE request for the given path. It checks that the response code and body match the regular expressions provided. Note that some servers will return 500 Internal Server Error if the path does not point to a valid media file (for example, if it is a directory).

SIP TCP, TLS & UDP

The SIP monitor sends OPTIONS requests to the nodes, and checks the response code and body against the regular expressions provided. The requests are constructed such that servers that do not support the OPTIONS command should return 483 Too Many Hops, which the default regular expressions will accept.

The SIP UDP monitor provides an additional option that allows responses to the monitor's requests to be sent from any IP and port. This option should be used if your SIP server does not send responses from the IP and port on which it received the corresponding request.

SMTP

This is identical to the POP monitor, except that it checks for the SMTP server banner being returned.

Server First

This is a generic monitor that can be used to check services where the server writes data first. It will connect to the node, and check that the server returns some data. This monitor can easily be altered to check for specific data being returned by the server.

Simple HTTP & HTTPS

These monitors are simpler versions of the "Full HTTP/S" monitors, and just request the home page from each node. They check that the response code is a 2xx, 3xx, or 4xx response code.

You can create your own monitor by using one of the built-in monitors above as a template, and create a copy of them from their Edit page. Alternatively you can start from scratch, and create a monitor from the base types.

TCP Transaction

This performs a TCP transaction with the target machine, with an optional string of data to write to the connection. It can look for a specified regex in the response.

Ping

This pings the target machine at specified intervals.

External Program

This runs an executable program or script, located on the traffic manager under ZEUSHOME/zxtm/conf/scripts. Two fixed arguments, ip address and port, are sent to this program in the form "--port=80 --ipaddr=1.2.3.4". The opportunity to specify further arguments, again of the form "--<arg>=<value>", is provided on the monitor edit page. An exit code of 0 is classed as a success; a code other than 0, or a timeout, is a failure. The facility to upload and manage your external monitor programs can be found on the Monitor Programs page.

Stingray provides a Perl module, ZEUSHOME/zxtm/lib/perl/Zeus/ZXTM/Monitor.pm, which provides functions to parse the arguments, write logs, and exit with success or failure. Scripts written in Perl can reference the module directly to incorporate this functionality.

When creating a monitor of this type, you specify the program you wish to run from the drop-down list provided. All programs that appear in this list are those stored under ZEUSHOME/zxtm/conf/scripts. A further option, custom..., allows you to specify the full path to a program or script stored on the traffic manager at an alternative location. As Stingray automatically manages files inside of the 'scripts' directory across the cluster, any files you refer to outside of this directory MUST exist at the same location on each machine in the cluster. Failing to do so may cause an error on each traffic manager that cannot locate this program within its own filesystem.
HTTP

This sends an HTTP request to the target server, optionally using SSL, with specified parameters such as host header and the URL path to use. It searches for a status code regex in the response.

TCP Connect

This makes a TCP connection with the target machine, to check that a server is listening on the port.

SIP

This sends a SIP request to the target server of a specified transport type. It searches for a regex-matching status code and body in the response.

RTSP

This sends a RTSP request to the target server with a specified path. It searches for a regex-matching status code and body in the response.

You can edit the preset monitors in the catalog, i.e. modify the timings, failure conditions, and logging, along with any other monitor-specific settings (such as the web page to request).

The Client First TCP transaction monitor requires you to set the data to write to the connection, in order to function properly.

You can choose whether your monitor should be per-node or pool-wide. If it is pool-wide, you must specify a machine (and possibly port) for the monitor to test, such as an NFS server used by the pool.


Core Settings

These settings are identical for all monitor types, they control how often the monitor is run, and when a monitor is marked as failed:

delay
This controls how often a monitor runs. Increasing this time will slow the monitor down.
timeout
The time in which a monitor must complete. If it takes longer than this, the monitor run will be classed as having failed.
failures
The number of consecutive runs that must fail before a node is marked as failed. Once this number of failures has occurred, Stingray will be notified and an alert message will be raised.
verbose
Verbose logging can help with diagnosing problems with monitors. The logs will be written to the ZEUSHOME/zxtm/log/errors file.

Additional Settings

The additional settings control individual aspects of the monitor. The actual settings that are controlled here depend on which type of monitor is selected. For descriptions of the monitor types, see The Monitors Catalog.


Stingray can decrypt SSL traffic within the virtual server. This operation allows analysis of the traffic after decryption (in order to apply filters, rules or any other available features), without reducing processing power on the traffic manager.

The SSL catalogs contain the resources (certificates, DNSSEC private keys, certificate authorities, CRLs) required to manage an SSL-encrypted service.

There are restrictions on what are classed as acceptable cryptographic certificates and keys when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled).

For more information about these restrictions or FIPS 140-2 and the Stingray Traffic Manager in general, see the User Manual.

SSL Server Certificates Catalog

This catalog manages the certificates for SSL services you wish to decrypt, and lets you create self-signed certificates.

DNSSEC Private Keys Catalog

This catalog manages the keys used by a GLB service to alter DNSSEC authenticated responses.

Certificate Authorities and Certificate Revocation Lists Catalog

This catalog contains trusted certificates and Certificate Revocation Lists (CRLs), used when authenticating clients and nodes with SSL.

SSL Client Certificates Catalog

This catalog contains SSL certificates used when the traffic manager needs to authenticate itself against an SSL node.


An SSL certificate is used by clients to authenticate the server, and provide encryption for the SSL connection.

SSL Certificates

This section gives an overview of your SSL certificates. It also shows the information contained in the SSL certificate.

Creating a New SSL Certificate

A new SSL certificate can be created using the Create Self-Signed Certificate page. Self-signed certificates are only suitable for testing and should not be used for publicly-accessible services. Once a self-signed certificate is created, it can be signed by a certificate authority. It will then be suitable for publicly-accessible services.

Importing an SSL Certificate

If you already have an SSL certificate it can be imported into Stingray using the Import Certificate page.


Edit, copy or delete an existing certificate.

Edit Certificate

If the certificate is self-signed, you can edit all the information stored in the certificate. Enter the relevant information in the appropriate fields as follows:

If the certificate has already been submitted to a certificate authority for signing, then you should ensure that you supply an updated certificate request to the certificate authority.

If the certificate is already signed by a certificate authority, you cannot change any of the information in the certificate, as the certificate authority would need to re-sign the request. In this case you should create a new self-signed certificate.

Copy Certificate

To copy a certificate, you must provide a unique name and click the Copy Certificate button. A complete copy of the private key and certificate will be taken. It can be useful to save a copy of the certificate before replacing it with a new certificate from a certificate authority.

Certificate Signing

To create a Certificate Signing Request (CSR), you should use the Sign Certificate page. This page also lets you provide a new certificate from the certificate authority.

Delete Certificate

To delete a certificate, you should first ensure that it is not used by any virtual servers, then click the Delete Certificate button.


This provides a certificate signing request which can be used to generate a digitally signed certificate.

Certificate Signing Request (CSR)

The certificate signing request is a block of data encoding the information stored in the certificate in a format suitable for a certificate authority to sign. This is the data you need to provide to the certificate authority when you wish to get a certificate suitable for publicly-accessible services.

Copy the block of data and send it to the CA in a suitable format.

You might be asked to attach other credentials in your CSR.

Updating With a New Certificate

A certificate authority can generate a new certificate from your CSR. You should copy and paste the new certificate into the text box provided, and click Update Certificate.

Before uploading the new certificate, you may wish to take a copy of the original. A copy can be made using the Edit Certificate page.


When the certificate signed by a Certificate Authority isn't signed directly by the root certificate it may be necessary to send clients a complete certificate chain containing the signed certificate and the Certificate Authority's intermediate certificates.

Adding an Intermediate Certificate

An intermediate certificate can be uploaded using this page. It will be stored with your certificate and sent to any client that requests it.

If an intermediate certificate doesn't match either the server certificate or any intermediate certificates already uploaded it will be rejected by Stingray.

Updating an Intermediate Certificate

Intermediate certificates are updated by uploading a new certificate which replaces the old one.

Adding additional Intermediate Certificates

If the certificate chain contains more than one intermediate certificate (for example with Extended Validation, or EV, certificates) you will need to add them starting with the intermediate certificate that directly signed the server certificate. You will then be able to return to this page and upload the next certificate in the chain.


Create a new self-signed certificate.

Creating a New Certificate

To create a new self-signed certificate you must supply information that will be stored in the certificate. This is used by certificate authorities to check that the certificate and company match. You should ensure that this information is as accurate as possible. Once a self-signed certificate has been created, it is possible to change the details from the Edit Certificate page.

Self-signed certificates are only suitable for testing and should not be used for publicly-accessible services. However, when you have created a self-signed certificate you can get it signed by a certificate authority. The certificate authority will generate a new certificate that will be suitable for publicly-accessible services.

We recommend that keys to be used for publicly-accessible services are at least 2048 bits long. Consult references such as NIST Special Publication 800-57 for more details.


Import a certificate from your local machine.

Importing a Certificate and Private Key

To import an SSL certificate you must provide a unique name for it. You must also provide the locations of the PEM-encoded certificate and private key files. These files will be uploaded from your machine onto the traffic manager.

The Private key must not be encrypted. You can use openssl to unencrypt the key:
openssl rsa -in key.private

If this key is stored on secure hardware, you will need to configure SSL Hardware Support in System → Global Settings, and your hardware vendor's software may require additional steps to synchronize this machine's key list with that of the hardware. For the nCipher PKCS#11 library, if your key was not generated on the machine where Stingray is running, you must run /opt/nfast/bin/rfs-sync -U (where /opt/nfast is the path to your nCipher Support Software).
There are restrictions on what are classed as acceptable cryptographic certificates and keys when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled).

For more information about these restrictions or FIPS 140-2 and the Stingray Traffic Manager in general, see the User Manual.


The DNSSEC Private Keys Catalog contains Zone Signing keys used to alter DNSSEC signed DNS requests in a GLB Service

There are restrictions on what are classed as acceptable Zone Signing keys when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled).

For more information about these restrictions or FIPS 140-2 and the Stingray Traffic Manager in general, see the User Manual.


The Certificate Authorities and Certificate Revocation Lists Catalog contains trusted certificates and CRLs used when authenticating users with SSL. SSL users (Traffic manager clients and back-end nodes) can provide a SSL certificate to identify themselves.

Certificate Authorities and Certificate Revocation Lists

When Stingray authenticates a secure SSL connection, it examines the certificate that the client presents. It only accepts the connection if:


Certificates cannot be directly edited. If you need to alter the details of a certificate you have to contact the issuer of the certificate directly.

However, this page allows you to view and rename certificates that have been imported into Stingray.

You can also delete a certificate from the system, but you can only do this when the certificate is no longer in use (no virtual servers are using it).


Certificate Authority and certificate revocation list data is stored in a file on each traffic manager.

You can import a certificate or CRL file by providing the file directly, providing a URL of the file to use, or by copying the contents of the certificate directly into the text box on the Import page. Stingray will keep its own copy of the certificate (or CRL), whichever method is used. If the file is updated, you will need to upload it again.

Stingray will detect the file type (certificate or CRL). It will import new certificate files, and will apply CRL lists to existing CAs.

There are restrictions on what are classed as acceptable cryptographic certificates and CRLs when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled).

For more information about these restrictions or FIPS 140-2 and the Stingray Traffic Manager in general, see the User Manual.


The SSL Client Certificates Catalog contains SSL certificates used when the traffic manager needs to authenticate itself against an SSL node. It is used for identifying ourselves when re-encrypting Traffic.

Creating a new SSL client certificate

A new SSL client certificate can be created using the Create Self-Signed Certificate page. Self-signed certificates are only suitable for testing and should not be trusted by publicly-accessible services. Once a self-signed certificate is created, it can be signed by a certificate authority. It will then be suitable for publicly-accessible services.

Importing an SSL client certificate

If you already have an SSL certificate it can be imported into Stingray using the Import Certificate page.


Edit, copy or delete an existing certificate.

Edit Certificate

If the certificate is self-signed, you can edit all the information stored in the certificate. Enter the relevant information in the appropriate fields as follows:

If the certificate has already been submitted to a certificate authority for signing, then you should ensure that you supply an updated certificate request to the certificate authority.

If the certificate is already signed by a certificate authority, you cannot change any of the information in the certificate, as the certificate authority would need to re-sign the request. In this case you should create a new self-signed certificate.

Copy certificate

To copy a certificate, you must provide a unique name and click the Copy Certificate button. A complete copy of the private key and certificate will be taken. It can be useful to save a copy of the certificate before replacing it with a new certificate from a certificate authority.

Certificate signing

To create a Certificate Signing Request (CSR), you should use the Sign Certificate page. This page also lets you provide a new certificate from the certificate authority.

Delete certificate

To delete a certificate, you should first ensure that it is not used by any pools, then click the Delete Certificate button.

It is not possible for this page to tell you that a given certificate will be used by a given pool, because the certificate requirements are sent by the node during the SSL handshake, and cannot be predicted by the traffic manager in advance. Therefore, you should check the configuration of your back-end nodes before deleting a certificate, to be sure that none of them will ask for this certificate.

This provides a certificate signing request which can be used to generate a digitally signed certificate.

Certificate Signing Request (CSR)

The certificate signing request is a block of data encoding the information stored in the certificate in a format suitable for a certificate authority to sign. This is the data you need to provide to the certificate authority when you wish to get a certificate suitable for publicly-accessible services

Copy the block of data and send it to the CA in a suitable format.

You might be asked to attach other credentials in your CSR.

Updating with a new certificate

A certificate authority can generate a new certificate from your CSR. You should copy and paste the new certificate into the text box provided, and click Update certificate.

Before uploading the new certificate, you may wish to take a copy of the original. A copy can be made using the Edit Certificate page.


When the certificate signed by a Certificate Authority isn't signed directly by the root certificate it may be necessary to send backends a complete certificate chain containing the signed certificate and the Certificate Authority's intermediate certificates.

Adding an intermediate certificate

An intermediate certificate can be uploaded using this page. It will be stored with your certificate and sent to any client that requests it.

If an intermediate certificate doesn't match either the client certificate or any intermediate certificates already uploaded it will be rejected by Stingray.

Updating an intermediate certificate

Intermediate certificates are updated by uploading a new certificate which replaces the old one.

Adding additional intermediate certificates

If the certificate chain contains more than one intermediate certificate (for example with Extended Validation, or EV, certificates) you will need to add them starting with the intermediate certificate that directly signed the client certificate. You will then be able to return to this page and upload the next certificate in the chain.


Create a new self-signed SSL client certificate.

Creating a new certificate

To create a new self-signed certificate you must supply information that will be stored in the certificate. This is used by certificate authorities to check that the certificate and company match. You should ensure that this information is as accurate as possible. Once a self-signed certificate has been created, it is possible to change the details from the Edit Certificate page.

Self-signed certificates are only suitable for testing and should not be used for publicly-accessible services. However, when you have created a self-signed certificate you can get it signed by a certificate authority. The certificate authority will generate a new certificate that will be suitable for publicly-accessible services.


Import a certificate from your local machine.

Importing a certificate and private key

To import an SSL client certificate you must provide a unique name for it. You must also provide the locations of the PEM-encoded certificate and private key files. These files will be uploaded from your machine onto the traffic manager.

The Private key must not be encrypted. You can use openssl to unencrypt the key:
openssl rsa -in key.private

If this key is stored on secure hardware, you will need to configure SSL Hardware Support in System → Global Settings, and your hardware vendor's software may require additional steps to synchronize this machine's key list with that of the hardware. For the nCipher PKCS#11 library, if your key was not generated on the machine where Stingray is running, you must run /opt/nfast/bin/rfs-sync -U (where /opt/nfast is the path to your nCipher Support Software).
There are restrictions on what are classed as acceptable cryptographic certificates and keys when the FIPS 140-2 validated cryptographic module is in use (see fips!enabled).

For more information about these restrictions or FIPS 140-2 and the Stingray Traffic Manager in general, see the User Manual.


The Authenticators Catalog contains definitions of remote authentication services. These services can be accessed from TrafficScript to look up information about a user and to verify their password.

To query an authenticator in a TrafficScript rule you can use the auth.query() function, specifying the name of the authenticator you want to use and the username you want to look up.

Authenticators

Authenticators are displayed in alphabetical order. You can edit the settings for a specific authenticator by clicking on the name or the Edit link alongside it.

Create New Authenticator

You can add a new authenticator by entering the new authenticator name in the box provided. You will then be taken to the authenticator settings page, where you can make any necessary changes.


This page allows you to edit, copy, or delete the settings for an authenticator.

The authenticator can be invoked from a TrafficScript rule using the auth.query() function, providing the name of the authenticator and the username and password to be authenticated.

The authenticator will return information about whether or not the authentication attempt was successful, and, if configured to do so, will also return a selection of attributes from the user's record on the server.

See the documentation and example code for the auth.query() function in the TrafficScript Guide for more information on how to use authenticator objects from TrafficScript.

Basic Settings

This section allows you to rename the authenticator and change its basic configuration.

Name
You can rename the authenticator by editing this field. If the authenticator is renamed then any rules referencing this authenticator will be updated to use the new name.
host
This setting specifies the hostname or IP address at which the remote authenticator can be found.
port
This setting specifies the port on which the remote authenticator should be contacted.

LDAP Settings

This section allows you to configure settings for an LDAP-based authenticator.

ldap!bind!dn
The Distinguished Name (DN) of the 'bind' user. The bind user is used to contact the LDAP server and search for the record belonging to the user being authenticated.

The bind user must have permission to search for and read user records on the LDAP server.

If no bind user is specified then the traffic manager will attempt an anonymous login to search for the user being authenticated.

ldap!bind!password
The password for the bind user specified by the ldap!bind!dn setting.
ldap!filter
A filter used to extract the unique user record located under the base DN. The string %u will be replaced by the username supplied when the authenticator is invoked.

Examples of common LDAP filters include sAMAccountName=%u for Active Directory, or uid=%u for some Unix LDAP schemas.

ldap!filter!basedn
The base Distinguished Name (DN) under which the traffic manager will search for the record of the user being authenticated.

The entries for all users that are to be authenticated by this LDAP authenticator must appear under the DN specified here.

A typical base DN might be OU=users, DC=mycompany, DC=local.

ldap!attr
If the traffic manager finds a record for the user being authenticated on the LDAP server it can fetch back additional information from that record. This information can be used to perform additional checks on the user being authenticated, such as restricting access based on which group the user belongs to.

To fetch back specific attributes from the user's record, a space- or comma-separated list of attribute names can be specified in the ldap!attr setting.

To fetch back all attributes from the user's record, set ldap!attr to '*'.

If the setting is blank, no additional attributes will be retrieved from the server.

Any attributes retrieved from the user's record will be available in the return value from the TrafficScript function that requested the authentication.

ldap!ssl
This setting determines whether or not the connection to the LDAP server will be SSL-encrypted. The method by which the SSL connection is established can be specified in the ldap!ssl!type setting.
ldap!ssl!type
This setting specifies the method by which an SSL connection to the LDAP server is established. It is used only if ldap!ssl is set to Yes.

The available methods are:

  • LDAPS: The traffic manager will establish a secure connection to the LDAP server before any LDAP messages are sent.
  • Start TLS: The traffic manager will use the LDAPv3 Transport Layer Security extension to establish a secure connection to the server.
ldap!ssl!cert
When connecting to the remote LDAP server over SSL, the traffic manager will ensure that the server's certificate is signed by the certificate authority specified by this setting.

If the server sends a certificate that is not signed by the certificate authority specified here then an error will be returned to the TrafficScript function using the authenticator.

If no certificate authority is specified then the server's certificate will not be validated.

Apply Changes

Click the Update button to apply any settings that have been changed.

Save As New Authenticator

To copy the authenticator, enter a new name in the Save As box and click Save.

Delete Authenticator

To delete the authenticator, check the Confirm box and then click the Delete button.


This is the repository for service protection classes that you can apply to your virtual servers to provide protection against network attack.

Service Protection Classes

Classes are displayed in alphabetical order. You can edit the settings for a specific class by clicking on the class name or the Edit Class link alongside it.

Each service protection class provides options to harden a particular virtual server against common DoS (Denial of Service) attacks and application layer attacks. It is also possible to associate a rule with each class, to enable sophisticated decisions to be made about the incoming traffic based on all the information about a connection.

To associate a service protection class with a virtual server, go to the Virtual Servers configuration page and edit the settings of the server you wish to protect. You will be able to add a service protection class by editing the appropriate section.

Create New Service Class

You can add a new service protection class by entering the new class name in the box provided. You will then be taken to the class settings page, where you can make any necessary changes.


The settings of a service protection class can be edited here.

Basic Settings

These settings enable and disable service protection and control the mode in which the class operates.

enabled
This setting allows you to enable and disable the service protection class. When disabled, the service protection class will not block any connections.
log_time
This setting allows you to configure how often service protection summaries are printed to the event log. The summary contains information about how many connections were dropped since the last summary message was printed.
debug
This setting allows you to enable and disable verbose logging. When enabled, any connections that are dropped or refused by this service protection class will be individually noted in the event log.
testing
This setting allows you to observe how the service protection class will affect incoming connections without actually causing any disruption to them. If the service protection class determines that a connection should be blocked then a message will be printed to the event log, but the connection will still be allowed through.

Connection Limiting Settings

These settings allow you to limit the number of simultaneous connections each client can have and the frequency with which they can create new connections.

min_connections
This is the number of simultaneous connections that will always be allowed from one IP address, even if it is in a group whose connections are being capped.
max_1_connections
This is the maximum number of simultaneous connections that will be allowed from the same IP address.
max_10_connections
This is the maximum number of simultaneous connections that will be allowed from the 10 busiest IP addresses. By combining this with the max_1_connections setting you can configure your site to allow individual users a greater number of connections when your site is not busy and then restrict the number of connections each user is allowed when you have more visitors.
max_connection_rate
This is the maximum number of connections allowed from one IP during the interval specified by the rate_timer setting. If you apply this protection class to a virtual server that manages HTTP traffic then any requests sent on a connection that is kept alive will also count towards this rate.
rate_timer
This setting affects how frequently the max_connection_rate setting is assessed. If set to 60, for example, then if a particular client creates more than max_connection_rate connections (or sends more than max_connection_rate keepalive requests) in one minute, all further connections will be rejected for the remainder of the rate_timer interval.

Access Restrictions

Allowed IPs are IPs or IP/Mask(s) which are exempt from the normal service protection checks. Banned IPs are IPs or IP/Mask(s) from which connections are simply dropped. The Allowed list is checked first, so an IP address that is in both groups will be allowed.

To add to either of these lists, input the IP or IP/Mask in the appropriate box and then click Update in the Edit Class section. Entries can be of the form '10.0.1.0/255.255.255.0', '10.0.1.0/24', '10.0.1.' or '10.0.1.1'.

HTTP Specific Settings

These settings provide extra checks which can be performed on HTTP traffic.

Note: If you associate this service protection class with a virtual server that does not handle HTTP traffic, such as one which balances UDP, then these settings will be ignored.

http!send_error_page
If a connection fails any of the service protection class tests then it will be dropped. If the http!send_error_page setting is set then the traffic manager will send a response to the client before closing the connection. The response that is sent depends upon which test the connection failed:
  • A 400 Bad Request response will be sent if http!check_rfc2396 is set and the client sends a poorly-formed URL, if the length of any individual headers in the request exceeds http!max_header_length, if the total length of the headers exceeds the value specified in http!max_request_length, or if http!reject_binary is set and the client sends a header that contains binary data.
  • A 403 Forbidden response will be sent if the client's IP is in the list of banned IPs.
  • A 413 Request Entity Too Large response will be sent if the length of the body data contained in the HTTP request is greater than that specified by http!max_body_length.
  • A 414 Request URI Too Long response will be sent if the length of the URL is greater than that specified by http!max_url_length.
  • A 503 Server Too Busy response will be sent if the connection fails any of the max_1_connections, max_10_connections, or max_connections_rate tests.

Service Protection Rule

A TrafficScript rule can be associated with a Service Protection class to provide greater flexibility in controlling access to Stingray. If you select a rule, it will be run immediately after the access control checks. The rule can then make further decisions about allowing or disallowing the new connection (e.g. using connection.close() to reject it).

If you wish to change the rule, select the rule you wish to use from the drop-down menu and then click Update in the Edit Class section.

Edit Class

Clicking the Update button updates all of the changed values on the page.

Copy Class

Enter a new name in the box provided and click the Copy Class button to copy the class.

Delete Class

To delete a class, check the Confirm box and then click the Delete button.


Directing users to a particular node

Session persistence classes can be used to direct all requests in a client session to the same node. This may be necessary for complex applications, where an application session may be maintained over a number of separate connections. Examples of this include web-based shopping carts, and many complex UDP-based protocols.

Whenever a pool receives a new request which is not part of an established session, it will use the load-balancing algorithm to choose the optimal server node to assign the request to.

When a pool receives a request that is part of an existing session, session persistence will endeavor to send that request to the same node.

The session persistence class controls how the pool recognizes sessions, and how it copes when the correct node for an established session is unavailable.

Sessions will survive changes of destination port, such as when changing from HTTP (80) to HTTPS (443) to enter the secure section of a web site.

Use of the Traffic IP Groups setting 'consider client source port' can conflict with certain Session Persistence classes. With this setting enabled, requests from shared IPs could be distributed between different machines regardless of the persistence class(es) used. Please see the relevant section on the Traffic IP Groups Edit page for more details on its use.

Care must be taken when using a persistence class that is already in use by another pool. You should only re-use a persistence class if the nodes in both pools match. Session affinity can not be guaranteed where a persistence class is in use by two or more pools with different nodes.

Create New Persistence Class

You can add a new persistence class by entering the new class name in the box provided. You will then be taken to the class settings page, where you can make any necessary changes.


Session persistence can be used to direct all requests in a client session to the same node. This may be necessary for complex applications, where an application session may be maintained over a number of separate connections. Examples of this include web-based shopping carts, and many complex UDP-based protocols.

Whenever a pool receives a new request which is not part of an established session, it will use the load-balancing algorithm to choose the optimal server node to assign the request to.

When a pool receives a request that is part of an existing session, session persistence will endeavor to send that request to the same node.

The session persistence settings control how the pool recognizes sessions, and how it copes when the correct node for an established session is unavailable.

Sessions will survive changes of destination port, such as when changing from HTTP (80) to HTTPS (443) to enter the secure section of a web site.

Use of the Traffic IP Groups setting 'consider client source port' can conflict with certain Session Persistence classes. With this setting enabled, requests from shared IPs could be distributed between different machines regardless of the persistence class(es) used. Please see the relevant section on the Traffic IP Groups Edit page for more details on its use.

Session Persistence Methods

Stingray supports a range of different session persistence methods. Some methods are only applicable to certain protocol types:

IP-based persistence

IP-based session persistence sends all traffic from the same source IP address to the same destination node. This is generally appropriate for application-level session persistence, but some specialized mobile clients may change their IP address during a session, and some clients may share IP addresses (for example, via a proxy server), so it may not be suitable for some environments.

IP session maps are shared by all traffic managers in a cluster, so requests received by different traffic managers will apply the same sessions.

Universal session persistence

Universal session persistence uses data supplied to the pool by the 'connection.setPersistenceKey()' TrafficScript command as a key to identify which session the request is in.

Rule session maps are shared by all traffic managers in a cluster, so requests received by different traffic managers will apply the same sessions.

Named Node session persistence

This is a special class of session persistence that lets TrafficScript take full control over where requests are sent. The 'connection.setPersistenceNode()' TrafficScript command should be used to control which node each request gets sent to.

Transparent session affinity (HTTP only)

Transparent session affinity inserts cookies into the HTTP response to track sessions. This is generally the most appropriate method for HTTP and SSL-decrypted HTTPS traffic, because it does not require the nodes to set any cookies in their response. Cookies for this method can be identified by the prefix 'X-Mapping-', followed by a unique identifier.

Transparent session maps are stored in the client-side cookie, so all traffic managers in a cluster will send the same session to the same server node.

Application cookie persistence (HTTP only)

Application cookie persistence monitors a named cookie in the HTTP response from the node. For example, ASP applications often generate session cookies named 'ASPSESSIONID' that the pool could use to track sessions.

This persistence method directs a request to the same server node if it contains an application cookie. You need to specify the name of the application cookie you wish to monitor.

Application cookie session maps are stored in a client-side cookie, so all traffic managers in a cluster will send the same session to the same server node.

J2EE JSESSIONID cookies/URL persistence (HTTP only)

J2EE JSESSIONID cookies/URL persistence monitors both the JSESSIONID cookie (as for application cookie persistence) and the jsessionid path parameter. These are defined in the Java Servlet specification (v2.4) and are used by servlet containers such as BEA WebLogic, IBM WebSphere Application Server, JBoss/Tomcat and others.

J2EE session maps are shared by all traffic managers in a cluster, so requests received by different traffic managers will apply the same sessions.

ASP and ASP.NET cookie and cookieless persistence (HTTP only)

ASP session persistence monitors ASPSESSIONIDXXXXXXXX cookies generated by ASP applications.

ASP.NET session persistence monitors both the ASP.NET_SessionId cookie (as for application cookie persistence) and session keys embedded in the path when cookieless session persistence is enabled on the server.

ASP and ASP.NET session maps are shared by all traffic managers in a cluster, so requests received by different traffic managers will have the same session applied.

X-Zeus-Backend cookie persistence (HTTP only)

X-Zeus-Backend cookie persistence looks for a cookie named X-Zeus-Backend in each application request. If the cookie is present, and contains the name of a node in the current pool, the request is sent to that node. The cookie can be inserted either by a back-end server or by a TrafficScript rule.

This persistence method is deprecated, and provided only for backward compatibility with Stingray Load Balancer persistence cookies.
SSL session ID persistence (SSL pass-through only)

The SSL session ID persistence method sends all SSL traffic with the same SSL session ID to the same server node. It is only applicable to SSL pass-through traffic, not SSL-decrypted traffic.

The SSL session ID persistence method reduces the number of SSL handshake operations your nodes perform. SSL handshakes are expensive in terms of CPU time, network bandwidth and latency.

This method is not appropriate for application-level session persistence because many SSL clients regularly renegotiate their SSL session ID. To achieve application-level session persistence you should either use IP-based session persistence, or decrypt the traffic and use universal session persistence or an HTTP method if applicable.

SSL session ID session maps are shared by all traffic managers in a cluster, so if a request is received by a different traffic manager, it will apply the same session.

Session Failures

A pool may not be able to contact a required node because the node has been removed from the pool, or the pool is unavailable. In this case, the pool must take alternative action:

Close the connection (non-HTTP traffic)

The pool immediately closes the connection.

You can choose whether to discard or remember the session map. If you remember it, then if the client returns and the session's node is available, the request will be sent to the session's node.

Choose a new node to use

The pool discards the session map and chooses a new node, using the current load-balancing algorithm.

Send an HTTP redirect (HTTP traffic)

The pool sends an HTTP 302 redirect to the configured location (URL) as a response to the request. The resource at the redirect location could display a message, or cause the user to log in again and establish a new session.

You can choose whether to discard or remember the session map. If you remember it, then if the client returns and the session's node is available, the request will be sent to the session's node.

Edit Class

Clicking the Update button updates all of the changed values on the page.

Copy Class

Enter a new name in the box provided and click the Copy Class button to copy the class.

Delete Class

To delete a class, check the Confirm box and then click the Delete button.


Bandwidth management allows Stingray to control the number of bytes per second that can be used by a Virtual Server or by a particular type of request.

Normally, network bandwidth is provided at the highest rate possible for all connections. This may result in uneven use of your network, possibly with too much bandwidth being used by secondary services at the expense of your most critical services. Bandwidth management with Stingray allows you to control this imbalance explicitly.

If you have a cluster of more than one traffic manager, the Bandwidth Management System takes this into account. You do not need to make adjustments when new servers are being added, as this is done automatically.

Create New Bandwidth Class

You can add a new bandwidth class by entering the new class name in the box provided. You will then be taken to the class settings page, where you can make any necessary changes.


Speed

Enter a value, in kbits per second, in the Basic Settings box.

For example, if you wish to limit the bandwidth to 10Mb/s, this would be a value of 10000.

Note: Unlike storage or memory capacity, network throughput is conventionally measured in factors of 1000 (not 1024).

Sharing

There are three possible modes for how the bandwidth class shares out bandwidth between connections:

Edit Class

Clicking the Update button updates all of the changed values on the page.

Copy Class

Enter a new name in the box provided and click the Copy Class button to copy the class.

Delete Class

To delete a class, check the Confirm box and then click the Delete button.

Bandwidth management is not available on all configurations.


Providing service level monitoring information

Using Service Level Management, Stingray can measure and react to changes in response times for your Nodes, by comparing response times to a conformance value. You can obtain a graph of response times and other related information, or issue alerts or log when response times are below the conformance value. Stingray also has the ability to dynamically adjust the resources available based on response times, using TrafficScript rules.

Adding an SLM Class to the Catalog

To add a new SLM Class enter a name for your new class, and then click Create Class.

Service Level Management requires a license key. For further information please contact your account manager.

Each SLM Class contains definitions of ideal response times. SLM Classes have a warning and a serious threshold. When performance drops below a threshold, an event of that severity is emitted. Stingray can be configured to respond to such events in the Alerting section.

response_time
Responses that arrive within this time limit are treated as conformant. Responses that take longer than this time are non-conformant. (Time is in milliseconds).
serious_threshold
If the percentage of conformant responses drops below this level, a serious error level message will be emitted.
warning_threshold
If the percentage of conformant responses drops below this level, a warning message will be emitted.

Edit Class

Clicking the Update button updates all of the changed values on the page.

Copy Class

Enter a new name in the box provided and click the Copy Class button to copy the class.

Delete Class

To delete a class, check the Confirm box and then click the Delete button.


Rate shaping classes control the rate at which incoming requests are processed.

Rate shaping classes can only be used from within a TrafficScript rule.

Creating a new Rate Shaping Class

Enter a name for your new class and hit Create Class.

Using your Rate Shaping Class

Rate Shaping classes are used in TrafficScript rules.

Examples:

Limit the request rate of spiders:
$user_agent = http.getHeader( "User-Agent" );
if (string.regexmatch($user_agent,"googlebot|msnbot|slurp")) {
   rate.use("Spider Limiting Class");
}
       
Limit the request rate of an individual spider:
$user_agent = http.getHeader( "User-Agent" );
if (string.regexmatch($user_agent,"googlebot|msnbot|slurp")) {
   rate.use("Spider Limiting Class",$user_agent);
}
      

For more information about rate.use() see its section of the TrafficScript Reference


Rate shaping classes control the rate at which incoming requests are processed.

Rate shaping classes can only be used from within a TrafficScript rule.

Editing a Rate Shaping Class

max_rate_per_minute
Requests that are associated with this rate class will be rate-shaped to this many requests per minute (0 means unlimited).
max_rate_per_second
Although requests will be rate-shaped to the max_rate_per_minute value, Stingray will also rate limit per-second. This smooths traffic so that a full minute's traffic will not be serviced in the first second of the minute (0 means unlimited).

Using your Rate Shaping Class

Rate Shaping classes are used in TrafficScript rules.

Examples:

Limit the request rate of spiders:
$user_agent = http.getHeader( "User-Agent" );
if (string.regexmatch($user_agent,"googlebot|msnbot|slurp")) {
   rate.use("Spider Limiting Class");
}
       
Limit the request rate of an individual spider:
$user_agent = http.getHeader( "User-Agent" );
if (string.regexmatch($user_agent,"googlebot|msnbot|slurp")) {
   rate.use("Spider Limiting Class",$user_agent);
}
       

For more information about rate.use() see its section of the TrafficScript Reference


This section shows all the Cloud User Credentials that have been set up on your traffic manager.

If you have an account with a cloud provider such as Amazon or Rackspace you can use it for autoscaling of pools used by the traffic manager. A Cloud Credentials object stores the information required to access the API of an autoscaling pool. The Traffic manager determines the cloud status and creates or deletes nodes of an autoscaled pool as required. When you create a new set of Cloud Credentials you specify the login and password that identify you to the cloud as well as the API script to use. Once configured, such a set of credentials can be used by several different pools, but each pool is associated with exactly one 'cloud account'. Several sets (related to the same or different cloud providers) can be configured in the system for use by pools.


On this page you can specify the credentials the traffic manager uses for making cloud API calls. How exactly this information is used depends on the program that carries out the API calls, the script. Stingray Traffic Manager comes with three built-in scripts: Amazon EC2, Rackspace Cloud and VMware VSphere.

If you want to use Stingray autoscaling with other virtualized environments, you need to write your own script and install it on the traffic manager. The format of the invocation parameters and the expected output is described in more detail in the User Manual. Custom scripts must be installed in $ZEUSHOME/conf/extra and must be executable.

Basic Settings

Name

The name of the Cloud Credentials object

Cloud API

Select one of the built-in scripts, or a custom script if you have installed one. Cloud API scripts use up to three credentials for authentication. These are relabelled for the built-in scripts.

Credential 1

The first credential is typically a username, and is:
Access key IDfor Amazon EC2
User Namefor Rackspace Cloud
User IDfor VMware VSphere

Credential 2

The second is typically password to use with the username, and is:
Secret access keyfor Amazon EC2
Auth Keyfor Rackspace Cloud
Passwordfor VMware VSphere

Credential 3

The third could be an authentication token used in API calls, and is:
omittedfor Amazon EC2
Auth Tokenfor Rackspace Cloud
omittedfor VMware VSphere

VCenter server

For VMware VSphere autoscaling, the hostname or IP of the vCenter server.

update_interval

Stingray Traffic Manager periodically queries the cloud for the status of all instances running on behalf of the user. This is necessary in order to be up-to-date when nodes are added or removed by external systems. The update_interval determines how often these status calls are made. Note that some clouds impose a limit on the number of such calls per minute.

change_process_timeout

Cloud API calls can take some time to complete. This setting specifies the time that the traffic manager will wait before assuming that calls to create or destroy nodes have failed.


In this catalog you can upload, download and delete extra files that are used by Stingray.

These files include programs that can be executed by certain monitors and actions, files that can be used in TrafficScript rules and error files.

If the machine is part of a cluster, these files will be replicated on to all the other machines in the cluster.


In this catalog you can upload files that can be used by TrafficScript rules with the resource.get() function, or error files.

Error files are usually files showing user-friendly information, for example a .html or .txt showing an error message to the user in case a given service is unavailable. The selected file will be uploaded to the conf directory.


This is a repository for files that can be used by external program Monitors. These programs are executables that are stored in ZEUSHOME/zxtm/conf/scripts. This page provides a means of uploading these executables from your local machine, and downloading or deleting them.

A monitor program can be written in any language so long as it is an executable file. For more information on creating external program monitors, see the User Manual.

To use an external program within a monitor, first upload it using this page and then associate it with a new or existing external program monitor using the Monitors Catalog.

Stingray includes a pre-written Perl script, dns.pl, that appears in this section. This script identifies dns servers and ensures that they respond with the correct ip address when given a hostname to lookup.

It is not recommended that pre-written scripts are removed as they may be used by components of your Stingray system. Please refer to the scripts directly for further information.


This section stores externally-provided programs and scripts that can be used by Alerting actions. These external programs are executables that are stored in ZEUSHOME/zxtm/conf/actionprogs. This page provides a means of uploading these executables from your local machine, and downloading or deleting them.

A program can be written in any language so long as it is an executable file. For more information on creating external program actions, see the User Manual.

To have a program executed when an action is triggered, first upload it using this page and then associate it with a new or existing external program action using the Alerting page.


Developer Mode

Without a license the traffic manager can be used in developer mode. This mode enables all traffic manager functionality but heavily restricts bandwidth and SSL usage.

General Use

For general use your traffic managers need valid license keys to operate. License keys are restricted by IP address or MAC address, and may be limited to certain versions or dates. This page indicates that you do not have a license key installed. Possible reasons are:

To upload a license key file use the file browser and press the Install key button.

If you have no backup of your license or if you need to renew your license please contact your support provider.

If you are running your Stingray software as the root user (or another user who has enough privileges to reboot the machine) you can use this page to reboot the machine you are accessing the admin server on.

You can use this page to reboot the appliance you accessing the admin server on.

Other machines in a cluster will not be affected.

Any connections that the traffic manager is servicing at the time of the reboot will be lost

If you are running your Stingray software as the root user (or another user who has enough privileges to restart the software) you can perform this operation here.

You can use this page to restart the Stingray software on this appliance.

Other traffic managers in the cluster will not be affected.

Any connections that the traffic manager is servicing at the time of the restart will be lost.

If you are running your Stingray software as the root user (or another user who has enough privileges to shutdown the machine) you can use this page to shutdown the machine you are currently accessing.

You can use this page to shutdown the Stingray Appliance you are currently accessing.

Other machines in the cluster will not be affected.

Any connections that the traffic manager is servicing at the time of the shutdown will be lost.

For full documentation, refer to the TrafficScript Manual.

For real-life examples, visit the Riverbed Stingray Community.

Function Index

array
append, contains, copy, create, filter, join, length, pop, push, resize, reverse, shift, sort, sortNumerical, splice, unshift
auth
query
connection
checkLimits, close, discard, getBandwidthClass, getData, getDataLen, getLine, getLocalIP, getLocalPort, getMemoryUsage, getNode, getPersistence, getPool, getRemoteIP, getRemotePort, getServiceLevelClass, getVirtualServer, setBandwidthClass, setData, setIdempotent, setPersistence, setPersistenceKey, setPersistenceNode, setServiceLevelClass, sleep
connection.data
get, set
counter
increment
counter64
increment
data
get, getMemoryFree, getMemoryUsage, remove, reset, set
data.local
get, getMemoryFree, getMemoryUsage, remove, reset, set
event
emit
geo
getCity, getCountry, getCountryCode, getDistanceKM, getDistanceMiles, getIPDistanceKM, getIPDistanceMiles, getLatitude, getLocation, getLocationLonLat, getLongitude, getRegion, getRegionCode
glb
getDomain, getIPs
glb.service
avoidLocation, getLocationWeight, getName, getNearestLocation, ignoreLocation, isLocationLive, listDomains, listLocations, preferLocation, skip, useLocation
hash
contains, count, delete, empty, keys, values
http
addHeader, addResponseHeader, changeSite, cookie, doesFormParamExist, getBody, getBodyLines, getCookie, getCookies, getFormParam, getFormParamNames, getFormParams, getHeader, getHeaderNames, getHeaders, getHostHeader, getMethod, getMultipartAttachment, getPath, getQueryString, getRawQueryString, getRawURL, getRequest, getResponse, getResponseBody, getResponseBodyLines, getResponseCode, getResponseCookie, getResponseCookies, getResponseHeader, getResponseHeaderNames, getResponseHeaders, getResponseVersion, getVersion, headerExists, listFormParamNames, listHeaderNames, listResponseHeaderNames, normalizePath, redirect, removeCookie, removeHeader, removeResponseCookie, removeResponseHeader, responseHeaderExists, scrubRequestHeaders, scrubResponseHeaders, sendResponse, setBody, setCookie, setEscapedPath, setHeader, setIdempotent, setMethod, setPath, setQueryString, setRawPath, setRawQueryString, setResponseBody, setResponseCode, setResponseCookie, setResponseHeader
http.aptimizer
bypass, use
http.cache
disable, enable, exists, respondIfCached, setkey
http.compress
disable, enable
http.request
delete, get, head, post, put
http.request.ssl
get
http.stream
continueFromBackend, finishResponse, readBulkResponse, readResponse, startResponse, writeResponse
java
run
json
deserialize, serialize
lang
assert, chr, dump, isarray, ishash, max, min, ord, toArray, toDouble, toHash, toInt, toString, tochar, warn
log
error, info, warn
math
acos, asin, atan, ceil, cos, exp, fabs, floor, ln, log, pow, random, rint, sin, sqrt, tan
net.dns
resolveHost, resolveHost6, resolveIP
pool
activenodes, checknode, disablednodes, drainingnodes, failednodes, listactivenodes, listallnodes, listdisablednodes, listdrainingnodes, listfailednodes, select, use
rate
getbacklog, use
rate.use
noQueue
recentconns
exclude, include, markedForInclusion
request
avoidNode, endsAt, endsWith, get, getBandwidthClass, getDSCP, getDestIP, getDestPort, getLength, getLine, getLocalIP, getLocalPort, getLogEnabled, getMaxTransactionDuration, getRemoteIP, getRemotePort, getRetries, getToS, isResendable, retry, sendResponse, set, setBandwidthClass, setDSCP, setIdempotent, setLogEnabled, setMaxConnectionAttempts, setMaxReplyTime, setMaxTimedOutConnectionAttempts, setMaxTransactionDuration, setRemoteIP, setToS, setVirtualServerTimeout, skip
requestlog
exclude, include, markedForInclusion
resource
exists, get, getLines, getMD5, getMTime
response
append, close, flush, get, getBandwidthClass, getDSCP, getLength, getLine, getLocalIP, getLocalPort, getRemoteIP, getRemotePort, getToS, set, setBandwidthClass, setDSCP, setToS
rtsp
addRequestHeader, addResponseHeader, getMethod, getPath, getRawURL, getRequest, getRequestBody, getRequestBodyLines, getRequestHeader, getRequestHeaderNames, getRequestHeaders, getResponse, getResponseBody, getResponseBodyLines, getResponseCode, getResponseHeader, getResponseHeaderNames, getResponseHeaders, getVersion, listRequestHeaderNames, listResponseHeaderNames, redirect, removeRequestHeader, removeResponseHeader, requestHeaderExists, responseHeaderExists, sendResponse, setMethod, setPath, setRequestBody, setRequestHeader, setResponseBody, setResponseCode, setResponseHeader
rule
getName, getState
sip
addRequestHeader, addResponseHeader, getMethod, getRequest, getRequestBody, getRequestBodyLines, getRequestHeader, getRequestHeaderNames, getRequestHeaders, getRequestURI, getResponse, getResponseBody, getResponseBodyLines, getResponseCode, getResponseHeader, getResponseHeaderNames, getResponseHeaders, getVersion, listRequestHeaderNames, listResponseHeaderNames, redirect, removeRequestHeader, removeResponseHeader, requestHeaderExists, responseHeaderExists, sendResponse, setMethod, setRequestBody, setRequestHeader, setRequestURI, setResponseBody, setResponseCode, setResponseHeader
slm
conforming, isOK, threshold
ssl
clientCert, clientCertAlgorithm, clientCertChain, clientCertCommonName, clientCertEndDate, clientCertHash, clientCertIssuer, clientCertPublicKey, clientCertSHA1, clientCertSerial, clientCertSerialDec, clientCertStartDate, clientCertStatus, clientCertSubject, clientCertVersion, clientCipher, clientSupportsSecureRenegotiation, getClientCloseAlert, getServerCloseAlert, getTLSServerName, isSSL, requestCert, requireCert, serverCert, serverCertAlgorithm, serverCertCommonName, serverCertEndDate, serverCertHash, serverCertIssuer, serverCertName, serverCertPublicKey, serverCertSHA1, serverCertSerial, serverCertStartDate, serverCertSubject, serverCertVersion, serverSiteName, setClientCloseAlert, setServerCloseAlert, setTLSServerName, sslSessionID
stats
getQueueTime, getServerResponseTime, getTransactionDuration
string
BERToInt, Ireplace, IreplaceAll, append, base64decode, base64encode, bytesToDotted, bytesToInt, cmp, contains, containsI, count, decrypt, dottedToBytes, drop, encrypt, endsWith, endsWithI, escape, extractHost, extractPort, find, findI, findr, hash, hashMD5, hashSHA1, hashSHA256, hashSHA384, hashSHA512, hexToInt, hexdecode, hexencode, htmldecode, htmlencode, icmp, insertBytes, intToBER, intToBytes, intToHex, ipmaskmatch, left, len, length, lowercase, normalizeIPAddress, randomBytes, regexescape, regexmatch, regexsub, replace, replaceAll, replaceAllI, replaceBytes, replaceI, reverse, right, skip, split, sprintf, startsWith, startsWithI, substring, trim, unescape, uppercase, urlencode, urlencodeexceptreserved, validIPAddress, wildmatch
string.gmtime
parse
sys
domainname, getRestApiPort, getenv, getnetworkinterfaces, getpid, hostname, isFIPS, time, timeToString
sys.gmtime
format
sys.localtime
format
sys.time
highres, hour, minutes, month, monthday, seconds, weekday, year, yearday
tcp
close, connect, read, write
xml
validate
xml.validate
dtd, xsd
xml.xpath
matchNodeCount, matchNodeSet
xml.xslt
transform

array.append( array1, array2 )

Appends each element of array2 to the end of array1. Note that this behaviour is different to that of array.push(), which would add one new element to the end of array1 containing array2. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Append 4, 5 and 6 to the array
$numbers = [ 1, 2, 3 ];
array.append( $numbers, [ 4, 5, 6 ] );

# $numbers is now [ 1, 2, 3, 4, 5, 6 ]
See also: array.push

array.contains( array, value )

Returns whether or not the supplied array contains the specified value as an element. Note that it will not match elements inside sub-arrays.

$array = [ "one", "two", [ "three", "four" ] ];

# true
array.contains( $array, "one" );

# false
array.contains( $array, "three" );
See also: array.filter

array.copy( array )

Returns a copy of the supplied array. This is semantically equivalent to `$arraycopy = $array`, however it will warn if the variable passed to it is not an array.

# Loop around a sorted version of an array without
# permanently sorting it
$arr = [ "London", "Berlin", "Lisbon", "Paris" ];
foreach( $val in array.sort( array.copy( $arr ) )) {
   log.info( $val );
}

# $arr will be unsorted here
See also: array.create

array.create( size, [default] )

Creates a new array of the specified size and optionally fills the array with the default data.

# Create an array of length 20 with all the elements
# set to zero.
$zeroarray = array.create( 20, 0 );
See also: array.resize, array.copy

array.filter( array, pattern, [flags] )

Removes elements from the supplied array that do not match the pattern. The optional 'flags' parameter contains a string of single-letter options. The following options are supported:


The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Get the extension headers for this request
$headers = http.listHeaderNames();
$extensions = array.filter( $headers, "^X-", "i" );

array.join( array, [separator] )

Concatenates all the elements of the supplied array into a string separated by the separator. The elements will be separated by a space if no separator is supplied. Note that a warning will be printed should the supplied array itself contain any arrays or hashes.

# Print a comma-separated list of names
$names = [ "alice", "bob", "mallory" ];
log.info( array.join( $names, ", " ) );
See also: string.split

array.length( array )

Returns the length of the supplied array

# See how many HTTP headers there are
$headers = http.listHeaderNames();
log.info( "There are "
          . array.length( $headers )
          . " headers in this request" );

array.pop( array )

Removes the last element of the supplied array and returns it as the result of the function.

$stack = [];
array.push( $stack, 3 );
array.push( $stack, 2 );
array.push( $stack, 1 );
# $stack is now [ 3, 2, 1 ];

# Prints 1 2 3
while( array.length( $stack ) > 0 ) {
   log.info( array.pop( $stack ) );
}
See also: array.unshift, array.push, array.shift

array.push( array, value )

Adds the supplied value to the end of the supplied array. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Append 4 to the array
$numbers = [ 1, 2, 3 ];
array.push( $numbers, 4 );
See also: array.shift, array.unshift, array.pop

array.resize( array, size, [default] )

Resizes the supplied array to the specified size. If the size of the array is being increased and the default parameter is specified then the new elements added to the array will be set to the default parameter. If the new size is smaller than the original size then the appropriate number of elements will be removed from the end of the array. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# We're only interested in the first
# 10 lines of body data - but fill in the
# rest with blank lines if there are fewer
# than 10 lines.
$body = array.resize( http.getBodyLines(), 10, "" );
See also: array.create

array.reverse( array )

Reverses the elements of the supplied array. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

$array = [ 1, 2, 3, [ 4, 5 ] ];

# array will be [ [ 4, 5 ], 3, 2, 1 ]
array.reverse( $array );
See also: array.sort

array.shift( array )

Removes the first element of the supplied array and returns it as the result of the function.

$array = [ 1, 2, 3, 4 ];
# Empty an array from the front while printing
# its contents
while( array.length( $array ) > 0 ) {
   log.info( array.shift( $array ) );
}
See also: array.unshift, array.push, array.pop

array.sort( array, [reverse] )

Sorts the supplied array alphanumerically. If the reverse parameter is supplied then the array will be sorted in reverse. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Sort the keys of a hash before iterating over them
foreach( $key in array.sort( hash.keys( $hash ) ) ) {
   log.info( $key . " maps to " . $hash[$keys] );
}

# Sort these numbers alphanumerically
$sorted = array.sort( [ 1, 2, 3, 4, 10, 11 ] );

# The result will be [ 1, 10, 11, 2, 3, 4 ]
See also: array.sortNumerical

array.sortNumerical( array, [reverse] )

Sort the supplied array numerically in ascending order. If the reverse parameter is supplied then the array will be sorted in descending order. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Sort an array of numbers
$numbers = [ 2, 10, "3", "4", 24, "11" ];
array.sortNumerical( $numbers );

# $numbers is now [ 2, "3", "4", 10, "11", 24 ]
See also: array.sort

array.splice( array, offset, length, [values] )

Replace elements in the supplied array. Any elements between offset and length will be removed from the array and any extra values specified after the length parameter will be inserted into the array at that location. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

$numbers = [ 0, 1, 2, 3, 4, 5 ];

# Starting from element 2, remove one element
# and insert "a" and "b" into the array
array.splice( $numbers, 2, 1, "a", "b" );

# $numbers is now [ 0, 1, "a", "b", 3, 4, 5 ]

# Starting at element 0, remove 3 elements
array.splice( $numbers, 0, 3 );

# $numbers is now [ "b", 3, 4, 5 ]
See also: array.filter

array.unshift( array, value )

Adds the supplied value to the front of the supplied array. The return value of this function can be used as the argument to another function to perform multiple operations on the same array.

# Prepend 1 to the array
$numbers = [ 2, 3, 4 ];
array.unshift( $numbers, 1 );
See also: array.shift, array.push, array.pop

auth.query( authenticator, user, [password] )

Queries the named authenticator for information about user and, if supplied, checks that password matches the password on record for that user. Authenticators can be configured from the Catalog > Authenticators page of the Administration Server.

After looking up the user, this function will return a hash with the following values set:

Authenticators can be configured to provide information about the supplied user, for example the groups to which they belong. This information will also be contained in the hash returned by the auth.query() function.

# Verify the user's password using an LDAP
# authenticator called 'ldap'
$auth = auth.query( "ldap", $user, $pass );
if( $auth['Error'] ) {
   log.error(
      "Error with authenticator 'ldap': " .
      $auth['Error']
   );
   connection.discard();
} else if( !$auth['OK'] ) {
   # Unauthorised
   http.sendResponse( "403 Permission Denied",
      "text/html", "Incorrect username or password",
      ""
   );
}

# Allow through members of the 'admin' group using
# the 'group' attribute returned by the authenticator
if( $auth['group'] != "admin" ) {
   http.sendResponse( "403 Permission Denied",
      "text/html",
      "You do not have permission to view this page",
      ""
   );
}

connection.checkLimits( [poolname] )

This function checks to see if the connection will be queued due to backend connection limits. The function returns 1 if the connection is within configured maximum limits for the named pool ( See max_connections_pernode setting in Pool > Connection Management ). The function returns 0 if the connection will exceed the configured maximum limits and will be queued.
If the named pool does not exist, your traffic manager will log a warning message and a value of -1 will be returned.

# A connection is queued if it exceeds
# max_connections_pernode.
# Send a failure response to the client.
if( !connection.checkLimits( "pool" ) ) {
   http.sendResponse( "500 Failure",
                 "text/plain",
                 "Reached maximum connections",
                 "" );
   connection.discard();
}

connection.close( Data, [Read] )

Writes the provided data directly back to the client. After the data has been sent, the connection is closed.
The optional second argument specifies whether data should continue to be read in from the client after sending this response, and wait for it to close the connection. If set to 0, the connection will close immediately. If non-zero, the traffic manager will wait and read any remaining data from the connection before closing it.
The default behaviour is to wait, because some client software will not read a response until it has sent its entire request.

# Send an instant response and close the connection
connection.close( "500 Go away\r\n" );
See also: connection.discard, http.sendResponse

connection.discard()

Immediately closes the current connection and stops processing rules. This is equivalent to the function call 'pool.use( "discard" )'.

# Drop this connection NOW!
connection.discard();
See also: connection.close, http.sendResponse

connection.getBandwidthClass() (deprecated)

Returns the current bandwidth class for the connection to the client, or an empty string if no class is set.

This function has been deprecated; response.getBandwidthClass should be used instead.

connection.getData( count ) (deprecated)

Returns the first 'count' bytes of data provided by the client.
Warning: you can stall a connection by asking it to read more data than the remote client will provide. Combine this with connection.getDataLen() to reliably read data from a connection.

This function has been deprecated; request.get should be used instead.

connection.getDataLen() (deprecated)

Returns the number of bytes of data already received from the client. This can be combined with connection.getData() to reliably read data from a connection without stalling if no data is available.

This function has been deprecated; request.getLength should be used instead.

connection.getLine( offset ) (deprecated)

Returns a line of input data provided by the client. The line separator is '\n', and this is stripped off before returning the line. connection.getline() takes a single byte-count argument which indicates where to start scanning for a line; a value of '0' begins at the start, so returns the first line.
When connection.getline() returns, the variable $1 is updated to point to the start of the next line in the datastream.
You can iterate through the lines of input data by using $1 as the iterator variable.

This function has been deprecated; request.getLine should be used instead.

connection.getLocalIP() (deprecated)

Returns the IP address that the client connected to, i.e. the address local to this machine.

This function has been deprecated; request.getLocalIP should be used instead.

connection.getLocalPort() (deprecated)

Returns the network port number that the client connected to. (e.g. port 80 is normal for a web server)

This function has been deprecated; request.getLocalPort should be used instead.

connection.getMemoryUsage()

Returns an estimate of the amount of memory currently in use for this connection, in bytes. Memory is primarily used for buffering data, and the memory usage can be tuned using the various buffer size settings.

# How much memory are we using?
$memoryusage = connection.getMemoryUsage();

connection.getNode()

Returns the name of the back-end node that this request is connected to. If a back-end node has not been chosen, which is normally the case in request rules, it returns the empty string.

# Which node is used for this connection
$nodename = connection.getNode();
See also: connection.getPool, connection.getVirtualServer, request.avoidNode

connection.getPersistence()

In a Response rule this function returns the name of the current Session Persistence class used for this connection, or whatever class has been set by a previous use of connection.setPersistence().

$class = connection.getPersistence();
See also: connection.setPersistence

connection.getPool()

Returns the name of the pool that this request is connected to. If a pool has not been chosen, it returns the empty string.

# Where are we connected to?
$poolname = connection.getPool();
See also: connection.getNode, connection.getVirtualServer

connection.getRemoteIP() (deprecated)

Returns the remote IP address of the client.

This function has been deprecated; request.getRemoteIP should be used instead.

connection.getRemotePort() (deprecated)

Returns the remote port of the client's connection.

This function has been deprecated; request.getRemotePort should be used instead.

connection.getServiceLevelClass()

Returns the current service level class for the connection, or an empty string if no class is set.

$class = connection.getServiceLevelClass();
See also: connection.setServiceLevelClass

connection.getVirtualServer()

Returns the name of the Virtual Server that the rule is running under.

# Are we on the secure site?
if( connection.getVirtualServer() == "secure" ) {
   pool.use( "secure" );
}
See also: connection.getNode, connection.getPool

connection.setBandwidthClass( name ) (deprecated)

Sets the bandwidth class for the current connection to the client. Providing an empty class name removes the bandwidth class from the connection. It returns zero if an error occurs (for example, if the bandwidth class does not exist), and 1 otherwise.

This function has been deprecated; response.setBandwidthClass should be used instead.

connection.setData( request data ) (deprecated)

Replaces the input data read from the client with the provided string.
This is a low-level routine that should be used with care. For protocols with their own higher-level protocol managers (e.g. HTTP), use the higher level routines to alter the input data (e.g. http.setHeader() and http.setBody()).

This function has been deprecated; request.set should be used instead.

connection.setIdempotent( resend ) (deprecated)

Marks a request as resendable or non-resendable.
An idempotent request has no detrimental side effects, so it can safely be attempted multiple times. A non-idempotent request has a side effect - for example, it may update a database, or initiate a purchase.
By default, all non-HTTP requests are marked as idempotent. If a back-end node fails to generate a correct response when a request is initially forwarded to it, your traffic manager will attempt to resend the request to another node.
connection.setIdempotent() can override this behaviour. If 'resend' is zero, this indicates that the request should only be attempted against one back-end node.
If 'resend' has a non-zero value, this indicates that if a request is made to a back-end node and a correct response is not received, your traffic manager should retry the request against another back-end node.
Note that a request cannot be resent once it has begun streaming data between the client and the node. Additionally, UDP connections cannot be marked as resendable (the UDP client application should handle failed UDP responses).

This function has been deprecated; request.setIdempotent should be used instead.

connection.setPersistence( name )

Sets the Session Persistence class that will be used for the connection. This is used to override the default Session Persistence class that will be used once a Pool is selected.
If no parameter is given then the current Session Persistence class will be removed and the Pool's default session persistence class will be used for this connection.

connection.setPersistence( "sales" );
See also: connection.getPersistence, connection.setPersistenceKey

connection.setPersistenceKey( value )

Sets the value of the Session Persistence key that is used by a Universal Session Persistence type class.
Setting the value to the empty string will remove any persistence key from the connection.
A Session Persistence class that uses Universal Session Persistence attempts to ensure that every connection that provides the same key is directed to the same back-end node.
This function has no effect if a different type of session persistence class is ultimately used.

$value = http.getHeader( "User-Agent" ) .
         request.getRemoteIP();
connection.setPersistenceKey( $value );
connection.setPersistence( "my persistence class" );
See also: connection.setPersistence

connection.setPersistenceNode( value )

Sets the back-end node to be used by a NamedNode Persistence class.
A Session Persistence class that uses NamedNode Persistence will then ensure that this node will be used for the request. The node must be valid and exist in the Pool being used. If no port number is given, or if the port number is not valid, then if there is a node with a matching name, it will be used. For example, if the node 'web:80' is specified, but there is only a 'web:443', then that node will be used instead. This is to help share session persistence between different services on the same machine.
This function has no effect if a different type of session persistence class is ultimately used.

# Use the node 'web:80' for this request
connection.setPersistenceNode( "web:80" );
See also: connection.setPersistence

connection.setServiceLevelClass( level )

Sets the service level class for the current connection. It returns zero if an error occurs (for example, if the service level class does not exist), and 1 otherwise

connection.setServiceLevelClass( "gold" );
See also: connection.getServiceLevelClass

connection.sleep( milliseconds )

Pauses processing of the current connection for the specified number of milliseconds. This can be used to rate-limit particular clients; for example, those asking for particular files, or from particular locations, or using particular user-agents.

# Pause this connection for 2 seconds
connection.sleep( 2000 );

connection.data.get( key )

Returns the value that was previously stored with the given key using connection.data.set() in the current connection, or returns the empty string if no data was stored.

# Track the state of this connection so that we
# can process the response correctly
$req = request.get( 5 );
if( string.startsWith( $req, "LOGIN" ) ) {
   connection.data.set( "state", "login" );
} else {
   connection.data.set( "state", "" );
}

# ...
# in the response, ...
$state = connection.data.get( "state" );
See also: connection.data.set, data.get

connection.data.set( key, value )

Stores a value for this connection, associating it with the provided key. The value can be retrieved later when processing the same connection, using connection.data.get(). Once the connection finishes, the value cannot be retrieved.

# Track the state of this connection so that we
# can process the response correctly
$req = request.get( 5 );
if( string.startsWith( $req, "LOGIN" ) ) {
   connection.data.set( "state", "login" );
} else {
   connection.data.set( "state", "" );
}

# ...
# in the response, ...
$state = connection.data.get( "state" );
See also: connection.data.get, data.set

counter.increment( counter, [amount] )

Increments the numbered counter. These counters are readable via SNMP, and can be graphed on the Current Activity page on the Administration Server.
By default, the counter is incremented by one, but you can also supply an amount to increment the counter by. If a negative amount is supplied the counter is decremented, but please keep in mind that a decrement is indiscernible from a wrap-around.

# Increment the first user counter by 100
counter.increment( 1, 100 );
# Increment the first user counter by 1
counter.increment( 1 );
See also: counter64.increment

counter64.increment( counter, [amount] )

Increments the numbered 64 bit counter. These counters are readable via SNMP, and can be graphed on the Current Activity page on the Administration Server. 64 bit counters exist in a separate name- and storage space from the 32 bit counters, i.e. they don't overlap in any way.
By default, the counter is incremented by one, but you can also supply an amount to increment the counter by. If a negative amount is supplied the counter is decremented, but please keep in mind that a decrement is indiscernible from a wrap-around. Also please note that the supplied increment amount is limited to signed 32 bit range even though the counter is 64 bit.

# Increment the first 64 bit user counter by 100
counter64.increment( 1, 100 );
# Increment the first 64 bit user counter by 1
counter64.increment( 1 );
See also: counter.increment

data.get( key )

Returns the value that was previously stored with the given key using data.set(), or returns the empty string if no data was stored.
Values stored in this way are persistent; a value stored in one rule can later be retrieved by a different rule handling a different connection. Thus, a rule can maintain persistent state across connections.

data.set( "count", 7 );

# In another rule or connection...
$value = data.get( "count" ); # Returns 7
See also: data.set, data.remove, data.getMemoryUsage

data.getMemoryFree()

Returns the amount of free space, in bytes, available for storing information with data.set().
If memory space is low, then data.reset() can be used to clear some or all of the entries from the storage. Alternatively, the upper limit on memory can be configured using trafficscript!data_size on the Global Settings page.

# If running low on storage, clear some temporary
# data that other rules have stored.
$bytes = data.getMemoryFree();
if( $bytes < 1024 ) {
   data.reset( "temp-" );
}
See also: data.set, data.reset, data.getMemoryUsage

data.getMemoryUsage()

Returns an estimate of the amount of memory, in bytes, used by entries that have been stored by data.set().
This can be used to verify if a rule is storing excessive amounts of data, starving the host machine of memory.

$bytes = data.getMemoryUsage();
See also: data.set, data.reset, data.getMemoryFree

data.remove( key )

Removes the value that was previously associated with the given key using data.set().
data.remove() returns 1 if the item did exist, or 0 if it was not found.

data.set( "cache-$url", $obj );

# In another rule or connection...
data.remove( "cache-$url" );
See also: data.set, data.get, data.reset

data.reset( [prefix] )

Removes some or all of the mappings created by data.set(). With no arguments, it removes all keys. With a single argument, it removes all keys that begin with the supplied string.
NOTE: Should you intend to delete a specific individual key, data.remove() is more suited to this task. It offers greater performance and also ensures there is no risk of accidentally deleting other keys that start with the same string.

# Free some memory if we've used too much
if( data.getMemoryUsage() > 102400 ) {
   data.reset( "mappings-" );
}
See also: data.set, data.remove, data.getMemoryUsage, data.getMemoryFree

data.set( key, value )

Stores a value, associating it with the provided key. The value can be retrieved later using data.get(), even from a different rule or connection.
The value will be stored as a string, implicit conversion of floating point numbers to strings can cause some precision loss. You can convert a floating point number into a string with no precision loss using 'string.sprintf( "%f", $val )'. Arrays and hashes are serialised before storing and will be deserialised into their original form when retrieved with data.get().
To prevent memory problems, there is an upper limit on the amount of data that can be stored in the TrafficScript data storage. This means that the data.set() may fail. The upper limit can be configured using trafficscript!data_size on the Global Settings page.
data.set() returns true if the entry was stored, or false if there was no room.

# Associate $value with $key for future retrieval
data.set( $key, $value );

# Run this code only once:
if( !data.get( "runonce" ) ) {
   # Do initialization
   # ...
   data.set( "runonce", 1 );
}
See also: data.get, data.remove, data.getMemoryUsage

data.local.get( key )

Returns the value that was previously stored with the given key using data.local.set(), or returns the empty string if no data was stored.
Values stored in this way are persistent; a value stored in one rule can later be retrieved by a different rule handling a different connection as long as it is handled by the same child process. Thus, a rule can maintain persistent state across connections. The value can be different or non-existent on another child process.
data.local.get() and data.local.set() are useful for caching data where coherence is not required.

data.local.set( "count", 7 );

# In another rule or connection handled
# by the same child process ...
$value = data.local.get( "count" ); # Returns 7
See also: data.local.set, data.local.remove, data.local.getMemoryUsage

data.local.getMemoryFree()

Returns the amount of free space, in bytes, available for storing information with data.local.set().
If memory space is low, then data.local.reset() can be used to clear some or all of the entries from the storage. Alternatively, the upper limit on memory can be configured using trafficscript!data_local_size on the Global Settings page.

# If running low on storage, clear some temporary
# data that other rules have stored.
$bytes = data.local.getMemoryFree();
if( $bytes < 1024 ) {
   data.local.reset( "temp-" );
}
See also: data.local.set, data.local.reset, data.local.getMemoryUsage

data.local.getMemoryUsage()

Returns an estimate of the amount of memory, in bytes, used by entries that have been stored by data.local.set().
This can be used to verify if a rule is storing excessive amounts of data, starving the host machine of memory.

$bytes = data.local.getMemoryUsage();
See also: data.local.set, data.local.reset, data.local.getMemoryFree

data.local.remove( key )

Removes the value that was previously associated with the given key using data.local.set().
data.local.remove() returns 1 if the item did exist, or 0 if it was not found.

data.local.set( "cache-$url", $obj );

# In another rule or connection...
data.local.remove( "cache-$url" );
See also: data.local.set, data.local.get, data.local.reset

data.local.reset( [prefix] )

Removes some or all of the mappings created by data.local.set(). With no arguments, it removes all keys. With a single argument, it removes all keys that begin with the supplied string.
NOTE: Should you intend to delete a specific individual key, data.local.remove() is more suited to this task. It offers greater performance and also ensures there is no risk of accidentally deleting other keys that start with the same string.

# Free some memory if we've used too much
if( data.local.getMemoryUsage() > 102400 ) {
   data.local.reset( "mappings-" );
}
See also: data.local.set, data.local.remove, data.local.getMemoryUsage, data.local.getMemoryFree

data.local.set( key, value )

Stores a value, associating it with the provided key. The value can be retrieved later using data.local.get(), even from a different rule or connection processed by the same child process.
The value will be stored as a string, implicit conversion of floating point numbers to strings can cause some precision loss. You can convert a floating point number into a string with no precision loss using 'string.sprintf( "%f", $val )'. Arrays and hashes are serialised before storing and will be deserialised into their original form when retrieved with data.local.get().
To prevent memory problems, there is an upper limit on the amount of data that can be stored in the local TrafficScript data storage. This means that the data.local.set() may fail. The upper limit can be configured using trafficscript!data_local_size on the Global Settings page.
data.local.set() returns true if the entry was stored, or false if there was no room.

# Associate $value with $key for future retrieval
data.local.set( $key, $value );

# Run this code only once:
if( !data.local.get( "runonce" ) ) {
   # Do initialization
   # ...
   data.local.set( "runonce", 1 );
}
See also: data.local.get, data.local.remove, data.local.getMemoryUsage

event.emit( custom event name, message )

Triggers a Custom Event identified by the 'custom event name'. Actions can be associated with the Custom Event by configuring an Event Type to contain a Custom Event with the specified 'custom event name', and then associating that Event Type with an Action.
The 'custom event name' cannot contain '/' or control codes.
In addition to custom actions, a log message will be produced containing the eventid and the message.

# Emit a debug statement.
event.emit( "debug1", "Some debug information" );
See also: log.info, log.warn, log.error

geo.getCity( ip )

Returns the city of the supplied IPv4 address, or the empty string.

# Get this IP's city, such as Santa Clara
$city = geo.getCity( "216.250.81.96" );

geo.getCountry( ip )

Returns the country name of the supplied IPv4 address, or the empty string.

# Get this IP's country, such as United States
$country = geo.getCountry( "216.250.81.96" );

geo.getCountryCode( ip )

Returns the two-character country code of the supplied IPv4 address, or the empty string.

# Get this IP's country code, such as US
$countryCode = geo.getCountryCode( "216.250.81.96" );

geo.getDistanceKM( lat1, lon1, lat2, lon2 )

Returns the distance in kilometres between two points on the earth's surface (identified by latitude and longitude), or -1 on error.

# Get the distance between two lat-long points in km
$d = geo.getDistanceKM( "52.2338", "0.1529",
                        "37.4062", "-121.9765" );

geo.getDistanceMiles( lat1, lon1, lat2, lon2 )

Returns the distance in miles between two points on the earth's surface (identified by latitude and longitude), or -1 on error.

# Get the miles between two lat-long points
$d = geo.getDistanceMiles( "52.2338", "0.1529",
                           "37.4062", "-121.9765" );

geo.getIPDistanceKM( ip1, ip2 )

Returns the distance in kilometres between the locations of two IPv4 addresses. It will return -1 unless both locations can be found.

# Get the distance between two IPs in kilometres
$d = geo.getIPDistanceKM( "11.12.13.14",
                          "25.26.27.28" );

geo.getIPDistanceMiles( ip1, ip2 )

Returns the distance in miles between the locations of two IPv4 addresses. It will return -1 unless both locations can be found.

# Get the distance between two IPs in miles
$d = geo.getIPDistanceMiles( "1.2.3.4", "5.6.7.8" );

geo.getLatitude( ip )

Returns the decimal latitude of the supplied IPv4 address, or the empty string if the location is unknown. This may be accurate to city, region or only country level: to find out, check whether geo.getCity() and geo.getRegion() return empty strings.

# Get this IP's decimal latitude (positive = north),
# such as 37.3961
$lat = geo.getLatitude( "216.250.81.96" );

geo.getLocation()

Returns the name of the location in which this traffic manager is based.

Note that traffic managers can be assigned to locations only when Stingray Multi-Site Cluster Management is enabled.

# Run this part of the rule if the request was
# sent to a traffic manager located in Cambridge
if( geo.getLocation() == "Cambridge" ) {
   # ...
}
See also: geo.getLocationLonLat

geo.getLocationLonLat()

Returns a hash containing the longitude and latitude of the location to which this request was sent.

Note that traffic managers can be assigned to locations only when Stingray Multi-Site Cluster Management is enabled and locations can be assigned a latitude and longitude only when using the Global Load Balancing feature.

# How for away from the traffic manager did this
# request originate from?
$loc = geo.getLocationLonLat();
$ip = request.getRemoteIP();
$reqlon = geo.getLongitude( $ip );
$reqlat = geo.getLatitude( $ip );
$reqloc = geo.getCountry( $ip );
log.info( "Request was sent from " .
          $reqloc . ", " .
          geo.getDistanceMiles( $loc["latitude"],
                                $loc["longitude"],
                                $reqlat, $reqlon ) .
          " miles away from here" );
See also: geo.getLocation

geo.getLongitude( ip )

Returns the decimal longitude of the supplied IPv4 address, or the empty string if the location is unknown. This may be accurate to city, region or only country level: to find out, check whether geo.getCity() and geo.getRegion() return empty strings.

# Get this IP's decimal longitude (positive = east),
# such as -121.962
$long = geo.getLongitude( "216.250.81.96" );

geo.getRegion( ip )

Returns the region (e.g. US state) of the supplied IPv4 address, or the empty string if the location is unknown or doesn't have a region.

# Get this IP's region, such as California
$state = geo.getRegion( "216.250.81.96" );

geo.getRegionCode( ip )

Returns the two-character region code (e.g. US state abbreviation) of the supplied IPv4 address, or the empty string. The code for a given region may differ between software versions.

# Get this IP's region code, such as CA
$stateCode = geo.getRegionCode( "64.69.78.223" );

glb.getDomain()

Get the domain currently being processed.

This function can only be used in GLB service rules.

# Disable balancing of the example.com domain
# if the client is in Boston, USA
$domain = glb.getDomain();
$ip = request.getRemoteIP();
if( $domain == "example.com"
      && geo.getCity( $ip ) == "Boston"
      && geo.getCountryCode( $ip ) == "US" ) {
   glb.service.skip();
}

glb.getIPs()

Get an array of the IPs associated with the domain currently being processed.

This function can only be used in GLB service rules.

# Log the IPs that were returned by the DNS server
# for the domain test.example.com
if( glb.getDomain() == "test.example.com" ) {
   $msg = "IPs returned to " . request.getRemoteIP()
        . " for domain test.example.com were: "
        . array.join( glb.getIPs(), ", " );
   log.info( $msg );
}

glb.service.avoidLocation( location )

Avoid the specified location when re-writing the DNS response for the current domain.

The effect of this is to narrow down the list of available locations to just those that are not avoided.

If a location is both preferred and avoided being preferred will take precedence. If all locations are avoided (and none preferred) the outcome of the balancing algorithm will be as if no preferences have been specified.

If the location is unknown, unconfigured, or dead this preference will have no effect on the balancing decision. (In these cases a warning event will be raised and logged.)

This function can only be used in GLB service rules.

# Do not use the UK between 01:00 and 03:00 GMT if
# possible to use another location
if( sys.gmtime.format( '%H' ) >= 1
      && sys.gmtime.format( '%H' ) < 3 ) {
   glb.service.avoidLocation( 'United Kingdom' );
}

glb.service.getLocationWeight( location, [ service ] )

Get the weight of the specified location, as configured for the Weighted Random load balancing algorithm for the specified service, or for the current service if no service is specified and the function is used in a GLB service rule.

If the service is not using the Weighted Random load balancing algorithm then the weight for all locations will be reported as 0.

If the location does not exist, or is not configured for the specified service, the function will return -1 and will print a warning to the event log.

A service must be specified if this function is used outside a GLB service rule.

# If debugging, never use the lowest weighted node
# - instead, keep it free for testing purposes
if( $debugging ) {
   # Build a list of weight -> location mappings
   $locs = glb.service.listLocations();
   $weights = [];
   foreach( $loc in $locs ) {
      $w = glb.service.getLocationWeight( $loc );
      $weights[$w] = $loc;
   }
   # Ignore the lowest weighted location
   $lowest = array.sortNumerical(
       hash.keys( $weights )
   )[0];
   glb.service.ignoreLocation( $weights[$lowest] );
}

glb.service.getName()

Get the name of the current GLB service configuration.

This is the service that has been picked to handle the current domain. It is this service that will have specified that the rule be executed.

This function can only be used in GLB service rules.

# Disable the service named MyService on Sundays
$name = glb.service.getName();
if( $name == "MyService"
      && sys.time.weekday() == 1 ) {
   glb.service.skip();
}

glb.service.getNearestLocation()

Get the name of the traffic manager location calculated to be the closest to geographic location the client IP. Note that only live traffic manager locations are considered in this calculation.

If no nearest traffic manager location could be calculated the empty string is returned.

This function can only be used in GLB service rules.

# Log the traffic manager location that is closest
# to the client
$nearest = glb.service.getNearestLocation();
log.info( "Location nearest to " .
   request.getRemoteIP() . " is " . $nearest );

glb.service.ignoreLocation( location )

Do not consider the specified location when re-writing the DNS response for the current domain.

This removes the specified location from the list of available locations.

Multiple locations can be ignored, if all available locations are ignored it will be as if all locations are dead. Ignoring locations takes precedence over preferring locations.

If the location is unknown, unconfigured, or dead this preference will have no effect on the balancing decision. (In these cases a warning event will be raised and logged.)

This function can only be used in GLB service rules.

# Never use the UK between 01:00 and 03:00 GMT
if( sys.gmtime.format( '%H' ) >= 1
      && sys.gmtime.format( '%H' ) < 3 ) {
   glb.service.ignoreLocation( 'United Kingdom' );
}

glb.service.isLocationLive( location, [ service ] )

Check if a location is live. A non-live location includes those for which monitors have failed, or those that are in the "draining" list for the specified service, or for the current service if no service is specified and the function is used in a GLB service rule.

The function returns 1 if the location is live, 0 if it isn't, and -1 if the location does not exist or is not configured for the current service.

A service must be specified if this function is used outside a GLB service rule.

# Log warning if first location is dead
$locs = glb.service.listLocations();
$status = glb.service.isLocationLive($locs[0]);
if( $status == 0 ) {
   log.warn( "Location " . $locs[0] . " is dead." );
}

glb.service.listDomains( [ service ] )

Get an array of the domains the specified GLB service is configured to handle, or the domains that the current GLB service is configured to handle if no service is specified.

This function can only be used in GLB service rules unless the service parameter is specified.

# Log the domains the current GLB service is
# configured to handle.
$domains = glb.service.listDomains();
log.info( "Configured domains: " .
   array.join( $domains, ", " ) );

glb.service.listLocations( [ service ] )

Get a priority-ordered array of the locations configured for the specified GLB service, or the current GLB service if none is specified. This is the value of the location_order config key.

This function can only be used in GLB service rules unless the service parameter is specified.

# Apply a custom global load-balancing algorithm
# without accessing a back-end DNS server, but
# using stored configuration on the traffic manager.
# Rule is used on a standard DNS virtual server.
$locations = glb.service.listLocations( "Gallery" );
foreach( $loc in $locations ) {
   if( glb.service.isLocationLive(
                              "Gallery", $loc ) ) {
      # Return DNS response with IP of location
   }
}
# Return DNS response to fallback IP - all locations
# are down

glb.service.preferLocation( location )

Prefer the specified location when re-writing the DNS response for the current domain. More than one location may be preferred by calling this function multiple times.

The effect of this is to narrow down the list of available locations to just those that have been selected as preferred. However, if no preferred locations are available balancing will fall back to other available locations.

If a location is both preferred and avoided being preferred will take precedence. If all locations are preferred the outcome of the balancing algorithm will be as if no preferences have been specified.

If the location is unknown, unconfigured, or dead this preference will have no effect on the balancing decision. (In these cases a warning event will be raised and logged.)

This function can only be used in GLB service rules.

# Prefer to use Australia between 01:00 and 03:00 GMT
# But if it isn't available fall back to balancing
if( sys.gmtime.format( '%H' ) >= 1
      && sys.gmtime.format( '%H' ) < 3 ) {
   glb.service.preferLocation('Australia');
}

glb.service.skip()

Skip the current service configuration. This means that no futher service rules will be executed and no balancing will occur for the domain currently being processed. The DNS records for the domain will be sent to the client unchanged. (Further A-record domains in the current DNS response may still be processed.)

The glb.service.skip() call does not return.

This function can only be used in GLB service rules.

# Do not balance requests from the local network
$ip = request.getRemoteIP();
if( string.IPMaskMatch( $ip, "10.0.0.0/16" ) ) {
   glb.service.skip();
}

glb.service.useLocation( location )

Force use of the specified location when re-writing the DNS response for the current domain.

If the location has IPs configured for the current service that match IPs returned in the DNS response for the current domain the response will be re-written to use only the IPs configured for the location.

If the location is unknown, unconfigured, or dead this preference will have no effect on the balancing decision. (In these cases a warning event will be raised and logged.)

This function can only be used in GLB service rules.

# Force use of Australia between 01:00 and 03:00 GMT
if( sys.gmtime.format( '%H' ) >= 1
      && sys.gmtime.format( '%H' ) < 3 ) {
   glb.service.useLocation( 'Australia' );
}

hash.contains( hash, key )

Returns whether the supplied hash contains a particular key.

# See if bob is in the hash of users
# and if so, whether his password matches
if( hash.contains( $users, "bob" ) ) {
   if( $users["bob"] == $password ) {
      # Access granted
   } else {
      # Access denied
   }
} else {
    # User does not exist
}
See also: hash.keys

hash.count( hash )

Returns the number of items in the hash.

# See how many HTTP headers there are
$headers = http.getHeaders();
log.info( "There are "
          . hash.count( $headers )
          . " headers in this request" );

hash.delete( hash, key )

Deletes the specified key from the hash. The return value of this function can be used as the argument to another function to perform multiple operations on the same hash.

$hash = [ "orange" => "fruit",
          "apple" => "fruit",
          "cabbage" => "vegetable",
          "pear" => "fruit" ];

hash.delete( $hash, "cabbage" );

# keys will be orange, apple and pear
$keys = hash.keys( $hash );
See also: hash.keys

hash.empty( hash )

Removes all the values from the hash. The return value of this function can be used as the argument to another function to perform multiple operations on the same hash.

# Empty the contents of a hypothetical set object
sub set.empty( $set ) {
   # You cannot do '$set = [];' here because that
   # would be reassigning the input variable
   hash.empty( $set );
}

set.empty( $my_set );
See also: hash.keys

hash.keys( hash )

Returns an array containing the keys that map to values in the supplied hash data structure.

# Get the set of IPs that have connected to the site
$ips = data.get( "connected_ips" );
$ips[request.getRemoteIP()] = 1;
data.set( "connected_ips", $ips );
$connected_set = hash.keys( $ips );
log.info( array.length( $connected_set ) .
          " unique IPs have connected to the site" );
See also: hash.values

hash.values( hash )

Returns an array containing the values that have been mapped to in the hash.

# Add up the values of a hash
$values = hash.values( $hash );
$total = 0;
foreach( $val in $values ) {
   $total += $val;
}
log.info( "The total is " . $total );
See also: hash.keys

http.addHeader( name, value )

Modifies the current HTTP request, adding an HTTP header with the supplied value. A case-insensitive lookup is first performed in order to find any existing headers. If a match is found, a duplicate header will be added to the message along with the new value.

# Add a host header if it is missing
if( !http.headerExists( "Host" ) ) {
   http.addHeader( "Host", "unknown" );
}
See also: http.setHeader, http.getHeader, http.removeHeader, http.headerExists, http.addResponseHeader

http.addResponseHeader( name, value )

Adds an HTTP header to the HTTP response that will be sent back to the client. If the header already exists in the response, then this value will be appended to the existing value. The header lookup is case-insensitive.

# Set a cookie to remember this user
http.addResponseHeader( "Set-Cookie",
   "id=12345678; path=/" );
See also: http.setResponseHeader, http.getResponseHeader, http.removeResponseHeader, http.addHeader

http.changeSite( name )

Redirect users to a new website. It is a more sophisticated version of http.redirect() that will preserve the original path that the request asked for. Note that it sends back a HTTP 301 redirect rather than the 302 response returned by http.redirect(). For instance, if the original request was for "http://www.example.com/image/image.jpg", then http.changeSite( "example.co.uk" ) would redirect the user to "http://example.co.uk/image/image.jpg" The redirection will preserve the original path (and any query string) of the request, together with the port number and protocol. If you wish to force any of these details, then you can specify them as part of the supplied host name. e.g. http.changeSite( "https://www.example.com" ) will always send people to a SSL-encrypted site. You can also add on a prefix to the path of the URL, e.g. http.changeSite( "www.example.com/oldsite" ) would redirect a request for "http://www.example.com/missing/page.html" to "http://www.example.com/oldsite/missing/page.html". If the original request matches the supplied redirection, then http.changeSite() will take no action and let the request continue. This ensures that no 'redirection loops' occur.

# Send users to our new site
if( http.getHostHeader() == "www.zeus.com" ) {
   http.changeSite( "www.riverbed.com" );
}
See also: http.sendResponse, http.redirect

http.cookie( name ) (deprecated)

Returns the value of the named cookie.

This function has been deprecated; http.getCookie should be used instead.

http.doesFormParamExist( Parameter )

Checks whether a form parameter is present, either in the URL query string, or if not found and the request is a POST, from the POST body data. It returns 1 if the parameter is present, and 0 if not.
This is useful when there are form parameters with no value, e.g a query string like 'foo=bar&stuff&x=y' - the 'stuff' parameter has no value, but is present.

# Did the user ask for fries with that?
if( http.doesFormParamExist( "fries" ) ) {
   # Do something
}
See also: http.getFormParam, http.listFormParamNames, http.getFormParams

http.getBody( [count] )

Returns the body data of the request. HTTP clients use the body data for sending file uploads or for HTML form parameters.
If the optional 'count' parameter is supplied, http.getBody() will only read and return this number of bytes. If count is 0, http.getBody() returns the entire request.
If the request has no body, then this returns an empty string.
http.getBody() will work in a response rule only if the entire request was read before the request rules completed (for example, if another call to http.getBody() was made in a request rule). Otherwise, request data will have been streamed to the server and not cached. If the request data is not available, this function will return the empty string.
This function is not usable in response rules, as the body data of the request will no longer be accessible.
To read HTML form parameters, it is easier to use http.getFormParam() as that will work for GET and POST requests.

# Read the entire request body
$body = http.getBody();
See also: http.getBodyLines, http.setBody, http.getResponseBody, http.getFormParams, http.listFormParamNames

http.getBodyLines( [count] )

Splits the body data of the HTTP request into individual lines and returns an array of the data.
If the optional 'count' parameter is supplied, http.getBodyLines() will only read and return this number of bytes. If count is 0, http.getBodyLines() returns the entire request.
If the request has no body, then this returns an empty array. This function is not usable in response rules, as the body data of the request will no longer be accessible.
To read HTML form parameters, it is easier to use http.getFormParams() as that will work for GET and POST requests.

# Read the entire request body
$body = http.getBodyLines();

# If the body data is some special format we can
# understand then we can process it line-by-line
if( array.length( $body ) > 0 ) {
   if( array.shift( $body ) == "Special data" ) {
      foreach( $line in $body ) {
         # handle special body data lines
      }
   }
}
See also: http.getBody, http.getResponseBodyLines

http.getCookie( name )

Returns the named cookie in the incoming HTTP request.
http.getCookie is a helper method that makes it easier to parse the HTTP Cookie header and extract the values of that particular cookie, rather than using http.getHeader() directly.
An HTTP 'Cookie' header can have multiple values, such as
  Cookie: user-id=Joe; user-type=gold
http.getCookie( ... ) will retrieve the 'Cookie' header line and parse it, returning the value of the cookie. If the cookie does not exist, http.getCookie() will return the empty string.

# Get the PHP session cookie
$cookie = http.getCookie( "PHPSESSIONID" );
See also: http.getCookies, http.setCookie, http.removeCookie, http.getResponseCookie

http.getCookies()

Returns a hash containing the names of all the cookies in this request mapped to their values.
An HTTP 'Cookie' header can have multiple values, such as
  Cookie: user-id=Joe; user-type=gold
http.getCookies() will retrieve the 'Cookie' header line and parse it, returning a hash mapping all the cookie names to their values.

# List all of the cookie names and their values
$cookies = http.getCookies();
foreach( $cookie in hash.keys( $cookies ) ) {
   log.info( $cookie . ": " . $cookies[$cookie] );
}
See also: http.getCookie, http.setCookie, http.removeCookie, http.getResponseCookies

http.getFormParam( Parameter, [Separator] )

Returns the %-decoded form parameter from the URL query string, or if not found and the request is a POST, from the POST body data.
If the parameter is provided twice, only the first will be returned, unless the optional separator is provided, in which case all matches will be returned, separated with this string.

# See what drink the user wanted
$drink = http.getFormParam( "drink" );
See also: http.setQueryString, http.getRawURL, http.getBody, http.listFormParamNames, http.getFormParams

http.getFormParamNames( Separator ) (deprecated)

Returns a list containing the names of all the form parameters present in the URL query string and, if the request is a POST, in the POST body data. The names are returned as a single string, separated by the string supplied to this function. If the same parameter appears multiple times in the request, it will only appear once in the list returned by this function.

This function has been deprecated; http.listFormParamNames should be used instead.

http.getFormParams()

Returns a hash mapping the names of all the form parameters present in the URL query string and, if the request is a POST, in the POST body data to their values. If the same parameter appears multiple times in the request then it will be mapped to an array of values in the hash that is returned by this function.

# Log all of the form parameters and values
$params = http.getFormParams();
foreach( $param in hash.keys( $params ) ) {
   $values = $params[$param];
   if( lang.isArray( $values ) ) {
      log.info($param . "=" .
               array.join( $values, ", " )
              );
   } else {
      log.info($param . "=" . $values);
   }
}
See also: http.getFormParam, http.doesFormParamExist, http.listFormParamNames

http.getHeader( name )

Returns the value of a named HTTP header in the HTTP request, or the empty string if the header does not exist or has an empty value. The lookup is case-insensitive.

# Get the browser name and version
$browser = http.getHeader( "User-Agent" );

# this returns the same value
$browser = http.getHeader( "user-agent" );
See also: http.getHeaders, http.setHeader, http.addHeader, http.removeHeader, http.headerExists, http.getResponseHeader, http.getHostHeader, http.getHeaders

http.getHeaderNames() (deprecated)

Returns a list of all the headers that are present in the request.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; http.listHeaderNames should be used instead.

http.getHeaders()

Returns a hash containing all the header names in the request mapped to their values.

# Show all the headers in the request
$headers = http.getHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: http.getHeader, http.setHeader, http.addHeader, http.removeHeader, http.headerExists, http.getResponseHeaders, http.getHostHeader

http.getHostHeader()

Returns the HTTP Host header. This value is lowercased and has the port removed. Any trailing full stop is also removed. For example if the Host header is 'www.Riverbed.com:80' then http.getHostHeader() returns 'www.riverbed.com'.

# Get the unambiguous Host header
$hostheader = http.getHostHeader();
See also: http.getHeader

http.getMethod()

Returns the HTTP method that was used to make the request, such as GET or POST.

# Was this an HTTP POST?
if( http.getMethod() == "POST" ) {
   # handle POST request ...
}
See also: http.setMethod

http.getMultipartAttachment( part )

Returns the specified data out of a multipart encoded HTTP request. The data contained in the part is returned on success, or "" if it doesn't exist for that part. $1 contains the Content Type of the part, and $2 contains the complete headers for that part.

$count = 0;
while( $data =
       http.getMultipartAttachment( $count ) ) {
  log.info( "Data was " . $data );
  log.info( "Content-Type was " . $1 );
  log.info( "Headers were " . $2 );
  $count = $count + 1;
}

http.getPath()

Returns the %-decoded path in the HTTP request URL, stripping the query string if one was provided. If there is a leading scheme and authority prefix, this is removed as well, so the URL "http://www.example.com/content?page=44" will be returned as "/content".

# Retrieve the path
$path = http.getPath();
See also: http.setPath, http.getRawURL, http.getQueryString, http.getRawQueryString, http.normalizePath

http.getQueryString()

Returns the %-decoded query string in the URL, or the empty string if no query string was provided.

# Was there a query string?
$qs = http.getQueryString();
if( $qs ) {
   # Handle query string ...
}
See also: http.setQueryString, http.getRawQueryString, http.setRawQueryString, http.getRawURL

http.getRawQueryString()

Returns the raw (non %-decoded) query string in the URL, or the empty string if no query string was provided.

# Was there a query string?
$qs = http.getRawQueryString();
if( $qs ) {
   # Handle query string ...
}
See also: http.setRawQueryString, http.getQueryString, http.setQueryString, http.getRawURL

http.getRawURL()

Returns the raw (non-decoded) URL data provided by the client in the first line of the HTTP request, after the method and before the HTTP version specifier.
The raw URL data includes both the path and query string if supplied and is not decoded. It may also contain the protocol and hostname if the client sent them. It could contain %-escaped characters that can be used to disguise the contents of the URL. Use http.getPath() or http.getQueryString() to return the %-decoded version of the path or query string.
This function could return raw urls of various forms including:


You can use http.normalizePath() on the path component to remove any '/../' or '/./' references.
In general it is better to use http.getPath() and http.getQueryString() to avoid the need to process the raw url.

$rawurl = http.getRawURL();
if( string.contains( $rawurl, "%00" ) ) {
   # Something suspicious here ...
   connection.discard();
}
See also: http.getPath, http.getQueryString, http.getRawQueryString, string.unescape, http.normalizePath

http.getRequest()

Returns the full HTTP request and headers, but does not include any body data.

# Check that the request is not too big
# for our servers
$request = http.getRequest();
if( string.len( $request ) > 2048 ) {
   http.sendResponse( "413 Request too large",
                      "text/plain",
                      "Request too large", "" );
}
See also: http.listHeaderNames, http.getHeader, http.getBody

http.getResponse()

Returns the beginning of the HTTP response (the status line and the headers), up to but not including the empty line that separates the headers from the body. The returned string does not include any body data.

# See if the response included any
# headers that start with 'Foo'
$response = http.getResponse();
if( string.regexMatch( $response, "^Foo" )) {
   log.info( "A 'Foo' header was found" );
}
See also: http.listResponseHeaderNames, http.getResponseHeader, http.getResponseBody

http.getResponseBody( [count] )

Returns the body of the HTTP response.
If the response has chunked transfer encoding this function will return the de-chunked body. Similarly if the response is gzip or deflate compressed the body will be returned uncompressed.
If the optional 'count' parameter is provided, http.getResponseBody() will read and return the first 'count' bytes of the response. If count is 0, http.getResponseBody() will return the entire response.

# Read the entire response body
$body = http.getResponseBody();
See also: http.setResponseBody, http.getBody

http.getResponseBodyLines( [count] )

Splits the body data of the HTTP request into individual lines and returns an array of the data.
If the response has chunked transfer encoding this function will return the de-chunked body. Similarly if the response is gzip or deflate compressed the body will be returned uncompressed.
If the optional 'count' parameter is provided, http.getResponseBodyLines() will read and return the first 'count' bytes of the response. If count is 0, http.getResponseBodyLines() will return the entire response.

# Read the entire response body
$body = http.getResponseBodyLines();
See also: http.setResponseBody, http.getBodyLines

http.getResponseCode()

Returns the status code from the first line of the HTTP response.

# Log 404 responses
if( http.getResponseCode() == 404 ) {
   log.info( "404 page for " . http.getPath() );
}
See also: http.setResponseCode

http.getResponseCookie( name )

Returns the value of the named cookie in the HTTP response.
http.getResponseCookie() is a helper method to make it easier to parse the HTTP Set-Cookie header and extract the values of that particular cookie, rather than using http.getResponseHeader() directly.
If the cookie does not exist, http.getResponseCookie() will return the empty string.
This function should be called in a response rule; it has no effect in a request rule.

# Get the PHP session cookie
$cookie = http.getResponseCookie( "PHPSESSIONID" );
See also: http.getResponseCookies, http.setResponseCookie, http.removeResponseCookie, http.getCookie

http.getResponseCookies()

Returns a hash containing the names of all the cookies being set in this response, mapped to their values.
This function should be called in a response rule; it has no effect in a request rule.

# List all of the cookies that are being set in
# the response and their values
$cookies = http.getResponseCookies();
foreach( $cookie in hash.keys( $cookies ) ) {
   log.info( $cookie . ": " . $cookies[$cookie] );
}
See also: http.getResponseCookie, http.setResponseCookie, http.removeResponseCookie, http.getCookies

http.getResponseHeader( name )

Returns the value of a named HTTP header in the HTTP response, or the empty string if the header does not exist or has an empty value. The header lookup is case-insensitive.

# Get the mime type of the response
$mime = http.getResponseHeader( "Content-Type" );

# note that the MIME type may look like
# 'text/html; charset=ISO-8859-1'
See also: http.setResponseHeader, http.addResponseHeader, http.removeResponseHeader, http.responseHeaderExists, http.getHeader

http.getResponseHeaderNames() (deprecated)

Returns a list of all the headers that are present in the response.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; http.listResponseHeaderNames should be used instead.

http.getResponseHeaders()

Returns a hash containing all the header names in the response mapped to their values.

# Show all the headers in the response
$headers = http.getResponseHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: http.getResponseHeader, http.setResponseHeader, http.addResponseHeader, http.removeResponseHeader, http.responseHeaderExists, http.getHeaders

http.getResponseVersion()

Returns the version of the HTTP protocol being used. It returns the version string in the first line of the HTTP response, such as 'HTTP/1.1'. It will return the empty string in the case of HTTP/0.9 response.

# Get the HTTP response version
$version = http.getResponseVersion();
See also: http.getVersion

http.getVersion()

Returns the version of the HTTP protocol being used. It returns the version string in the first line of the HTTP request, such as "HTTP/1.1". It will return the empty string in the case of HTTP/0.9, which does not have a version specifier in the request.

# Get the HTTP version
$version = http.getVersion();
See also: http.getResponseVersion

http.headerExists( name )

Reports if a named header exists or not. It is similar to http.getHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
The lookup is case-insensitive.
It returns 1 if the header exists, and 0 if it does not.

# Add a host header if it is missing
if( !http.headerExists( "Host" ) ) {
   http.addheader( "Host", "unknown" );
}
See also: http.getHeader

http.listFormParamNames()

Returns an array containing the names of all the form parameters present in the URL query string and, if the request is a POST, in the POST body data. If the same parameter appears multiple times in the request, it will only appear once in the list returned by this function.

# Log all of the form parameters and values
$params = http.listFormParamNames();
foreach( $param in $params ) {
   log.info($param . "=" .
            http.getFormParam($param, ","));
}
See also: http.getFormParam, http.doesFormParamExist

http.listHeaderNames()

Returns a list of all the headers that are present in the request.
The headers are returned as an array.

# Log all of the header names and values
$headers = http.listHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" . http.getHeader($header));
}
See also: http.getHeader, http.removeHeader, http.getRequest, http.listResponseHeaderNames

http.listResponseHeaderNames()

Returns a list of all the headers that are present in the response.
The headers are returned as an array.

# Log all of the header names and values
$headers = http.listResponseHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" . http.getHeader($header));
}
See also: http.getResponseHeader, http.removeResponseHeader, http.getResponse, http.listHeaderNames

http.normalizePath( url )

Flattens a decoded URL path, converting '//' to '/', '/./' to '/', and flattening '/a/../' to '/'. It returns the flattened path string.
If the file system path is invalid, this function returns the empty string. Invalid paths include those that contain disallowed characters like '\0', invalid hex-escapes, or that use '../' sequences to reference a location outside the local root.
This function should be used on the retrieved URL before attempting path matching for access control. Remember to pass in a %-decoded URL path, to prevent disguised paths and control codes from being 'hidden' in the path.

# Check for access to /secure
$path = http.normalizePath( http.getPath() );
if( !$path ) {
   # bad path ...
} else if( string.startsWith( $path, "/secure" ) ) {
   # request to restricted area: check credentials
}
See also: http.getPath

http.redirect( address )

Sends back a HTTP 302 redirect response, which will send a web browser to a different URL. This is equivalent to http.sendResponse( "302 Moved Temporarily", "text/html", "", "Location: " . $url );

# Redirect all 404 error pages to our front page
if( http.getResponseCode() == 404 ) {
   http.redirect( "http://www.riverbed.com/" );
}
See also: http.sendResponse, http.changeSite

http.removeCookie( name )

Removes the named cookie from the incoming HTTP request.
http.removeCookie is a helper method that makes it easier to parse the HTTP Cookie header and remove a particular cookie, rather than using http.getHeader() and http.setHeader() directly.

# Remove the 'Priority' cookie
http.removeCookie( "Priority" );
See also: http.getCookie, http.setCookie, http.removeResponseCookie

http.removeHeader( name )

Removes a named header if it exists in the request.

# Remove the 'Accept-Language' header if it exists
http.removeHeader( "Accept-Language" );
See also: http.getHeader, http.addHeader, http.setHeader, http.removeResponseHeader

http.removeResponseCookie( name )

Removes a cookie from the HTTP response.
This function should be called in a response rule; it has no effect in a request rule.

# Remove the 'Priority' cookie
http.removeResponseCookie( "Priority" );
See also: http.getResponseCookie, http.setResponseCookie, http.removeCookie

http.removeResponseHeader( name )

Removes the named HTTP header from the HTTP response. The header lookup is case-insensitive.

# Remove the 'Location' response header
http.removeResponseHeader( "Location" );
See also: http.setResponseHeader, http.getResponseHeader, http.addResponseHeader, http.scrubResponseHeaders, http.removeHeader

http.responseHeaderExists( name )

Reports if a named header exists in the HTTP response. It is similar to http.getResponseHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
Header lookups are case-insensitive.
It returns 1 if the header exists, and 0 if it does not.

if( http.responseHeaderExists( "Location" ) ) {
   # Web server is redirecting user to
   # another location
}
See also: http.getResponseHeader

http.scrubRequestHeaders( header1, header2, ... )

Limits the allowed HTTP request headers to a known set. The allowed headers can either be passed in as a list or space separated in a single argument.
Care should be taken when using this function to ensure that the headers that are required for connection handling are let through. At the very least, the following should be allowed:

Connection, Content-Length, Transfer-Encoding, Content-Type, Host
For a complete list of HTTP headers, refer to RFC2616. Protocols that extend HTTP, such as WebDAV, use other headers.

# Remove all headers, except the Connection,
# Content-Type, Transfer-Encoding, Content-Length
# and Host headers.

# These 2 examples are identical

http.scrubRequestHeaders( "Host",
   "Connection", "Content-Type",
   "Transfer-Encoding", "Content-Length" );

http.scrubRequestHeaders(
   "host connection content-type transfer-encoding".
   " content-length" );
See also: http.removeHeader, http.scrubResponseHeaders

http.scrubResponseHeaders( header1, header2, ... )

Limits the allowed HTTP response headers to a known set. The allowed headers can either be passed in as a list or space separated in a single argument.
Care should be taken when using this function to ensure that the headers that are required for connection handling are let through. At the very least, the following should be allowed:

Connection, Content-Length, Transfer-Encoding, Location
For a complete list of HTTP headers, refer to RFC2616. Protocols that extend HTTP, such as WebDAV, use other headers.

# Remove all headers, except the Date, Connection,
# Content-Type, Transfer-Encoding, Content-Length
# and Location headers.

# These 2 examples are identical

http.scrubResponseHeaders( "Date",
   "Connection", "Content-Type",
   "Transfer-Encoding", "Content-Length",
   "Location" );

http.scrubResponseHeaders(
   "date connection content-type transfer-encoding".
   " content-length location" );
See also: http.removeResponseHeader, http.scrubRequestHeaders

http.sendResponse( code, type, body, headers )

Hands back an HTTP response to the client instead of balancing the request via a pool onto a node. It generates a correct HTTP response from the response code, content type, body data and headers supplied. Multiple headers should be separated with \r\n (note, however, that your traffic manager may override some of these headers, e.g. the 'Connection' header). For more sophisticated behaviour (for example, compressing responses using http.compress.enable) the http.stream.* methods should be used to respond to a client.

# Deny access and close connection
http.sendResponse( "403 Permission Denied",
         "text/html", "Go away",
         "Set-Cookie: denied=Yes\r\nX-Foo: Bar");
See also: connection.close, connection.discard

http.setBody( body )

Sets the request body for this HTTP request to the supplied string, replacing any request body already present.
This also updates the 'Content-Length' header in the request to the length of the new body data.

# Change the order!
$body = http.getBody();
$body = string.regexsub( $body, "Buy", "Sell", "g" );
http.setBody( $body );
See also: http.getBody, http.setResponseBody

http.setCookie( name, value )

Sets the value of the named cookie in the incoming HTTP request.
http.setCookie is a helper method that makes it easier to parse the HTTP Cookie header and set the value of a particular cookie, rather than using http.getHeader() and http.setHeader() directly.
An HTTP 'Cookie' header can have multiple values, such as
  Cookie: user-id=Joe; user-type=gold

# Set the priority cookie
http.setCookie( "Priority", "Gold" );
See also: http.getCookie, http.removeCookie, http.setResponseCookie

http.setEscapedPath( url )

Replaces the path portion of the request URL with the supplied value. If the replacement value contains a '?', this function will also replace the query string; otherwise, any query string is preserved. Characters whose ASCII value is less than or equal to 32 and '%' will be %-encoded in the replacement value.

# Make customer buy widget:
http.setEscapedPath( "/purchase?product=widget" );
See also: http.getPath, http.setPath, http.setRawPath

http.setHeader( name, value )

Sets the value of the named HTTP header.
A case-insensitive lookup is first performed in order to identify any existing headers, replacing the value where a match is found.
Note that the "Connection" header is manipulated by your traffic manager and that changing its value in TrafficScript may not give the expected results.

# Add (or replace) an X-Forwarded-By header
http.setHeader( "X-Forwarded-By",
   "Stingray " . sys.hostname() );
See also: http.addHeader, http.getHeader, http.headerExists, http.removeHeader, http.setResponseHeader

http.setIdempotent( resend )

Marks a request as resendable or non-resendable.
An idempotent request has no detrimental side effects, so it can safely be submitted multiple times. A simple page retrieval is generally idempotent. A non-idempotent request has a side effect - for example, it may update a database, or initiate a purchase. The HTTP/1.1 specification regards all GET, HEAD, PUT, DELETE, OPTIONS and TRACE requests as idempotent.
Your traffic manager tags these requests as 'resendable'; if the request is submitted to a back-end node and a correct response is not received, your traffic manager will resubmit the request to another back-end node. All other requests, such as POST requests are not resent if a back-end node fails to generate a correct response.
http.setIdempotent() can override this behaviour. If 'resend' has a non-zero value, this indicates that if the request is submitted to a back-end node and a correct response is not received, your traffic manager should resubmit the request to another back-end node.
If 'resend' is zero, this indicates that the request should only be attempted against one back-end node.
Note that a request cannot be resent if it has begun streaming data from the client to the node before it detects the failure. To avoid this, you can read the entire request within the TrafficScript rule, so that it is buffered in its entirety internally in the TrafficManager.

# This request can be resent
if( http.getMethod() == "POST" ) {
   # Force the Stingray Traffic Manager
   # to read the entire HTTP body
   http.getBody();
   # Mark this request as resendable
   http.setIdempotent( 1 );
}
See also: request.setIdempotent

http.setMethod( method )

Sets the HTTP method, changing the original request.

# Force HTTP POSTs to GETs
if( http.getMethod() == "POST" ) {
   http.setBody( "" );
   http.setMethod( "GET" );
}
See also: http.getMethod

http.setPath( url )

Replaces the path portion of the request URL with the supplied value. If the replacement value contains a '?', this function will also replace the query string; otherwise, any query string is preserved. This function will %-encode any character excluding following set as defined in RFC3986 - Unreserved: A-Z, a-z, 0-9, ., _, - - Reserved: !, *, (, ), ;, :, @, &, =, +,' $, ',', ?, /, #, [, ] - '%'

# Make customer buy widget:
http.setPath( "/purchase?product=widget" );
See also: http.getPath, http.setRawPath, http.setEscapedPath, string.urlencode

http.setQueryString( querystring )

Replaces the query-string portion of the request URL with the supplied replacement. Any control characters in the replacement are %-encoded.

# Rewrite the query string
http.setQueryString( $newqs );
See also: http.getQueryString, http.setRawQueryString, http.getRawQueryString

http.setRawPath( url )

Replaces the path portion of the request URL with the supplied value. If the replacement value contains a '?', this function will also replace the query string; otherwise, any query string is preserved. URL will not be %-encoded.

# Make customer buy widget:
http.setRawPath( "/purchase?product=widget" );
See also: http.getPath, http.setPath, http.setEscapedPath

http.setRawQueryString( querystring )

Replaces the query-string portion of the request URL with the supplied replacement. Unlike http.setQueryString, control characters are not encoded.

# Rewrite the query string
http.setRawQueryString( "foo=%20bar" );
See also: http.getRawQueryString, http.setQueryString, http.getQueryString

http.setResponseBody( body, [transfer-encoding] )

Sets the response body for this HTTP response to the supplied string, replacing any response body already present.
This also updates the 'Content-Length' header in the response to the length of the new body data. In addition the 'Content-Encoding' header is removed as we only ever set body data which is not encoded or compressed. If the server is still sending the original response body when this function is called, the connection to the server will be harmlessly dropped.
The optional 'transfer-encoding' parameter indicates the encoding of the body data (for example, 'chunked').

$body = http.getResponseBody( 0 );
$body = string.regexsub( $body, "Buy", "Sell", "g" );
http.setResponseBody( $body );
See also: http.getResponseBody, http.setBody

http.setResponseCode( code, [message] )

Sets the status code and message in the first line of the HTTP response.

# Not enough credit!
http.setResponseCode( "402", "Payment required" );
See also: http.getResponseCode

http.setResponseCookie( name, value, [options] )

Sets a cookie in the HTTP response. If the named cookie already exists, this function replaces its value.
The options are a semi-colon separated list of cookie options, such as "domain", "path", "expires" and "secure".
If the named cookie exists and no 'options' are provided, the current options for the named cookie are preserved.
This function may be called from a request rule or a response rule.

# Set the priority cookie
http.setResponseCookie( "Priority", "Gold" );

# Set a username cookie, with various options
http.setResponseCookie( "Username", "mork",
   "domain=example.com; path=/cgi-bin" );
See also: http.getResponseCookie, http.removeResponseCookie, http.setCookie

http.setResponseHeader( name, value )

Sets a HTTP header in the HTTP response that will be sent back to the client. If the header already exists in the response, then it will be replaced with this new value. The header lookup is case-insensitive.
Note that this function should not be used with the Connection header, i.e. setResponseHeader("Connection", value) since it may not give the expected results.

# Change the server string
http.setResponseHeader( "Server",
   "Stingray" );
See also: http.addResponseHeader, http.getResponseHeader, http.removeResponseHeader, http.setHeader

http.aptimizer.bypass()

Do not use Aptimizer to optimize the result of this request. Note that http.aptimizer.bypass() should not be used to turn off content optimization for requests that have been previously optimized as this might result in some requests not being served. Instead, create a new Aptimizer profile with the mode set to 'Idle' and assign this profile to the request using http.aptimizer.use().

# Bypass content optimization if the query string
# contains a 'bypass_aptimizer' parameter. This could
# be used to quickly compare the difference between
# optimized and unoptimized versions of a web page.

if( http.doesFormParamExist( "bypass_aptimizer" ) ) {
   http.aptimizer.bypass();
}
See also: http.aptimizer.use

http.aptimizer.use( scope, profile )

Use the specified Aptimizer scope and profile to optimize web content served to the client that sent this request. If the named Aptimizer scope or profile does not exist then a warning message will be logged and the traffic manager will choose a scope matching the request based on the Aptimizer settings configured for the virtual server, and use the associated profile. If no scope matches the request then no optimization will occur. If the virtual server does not have Aptimizer enabled, then a warning message will be logged and no optimization will occur.

# Optimize web content for clients based in Australia
$ip = request.getRemoteIP();
if( geo.getCountry( $ip ) == "Australia" ) {
   http.aptimizer.use(
      "Any hostname or path",
      "Remote Users"
   );
}
See also: http.aptimizer.bypass

http.cache.disable()

Prevents this response from being cached. In a request rule, this additionally prevents a cache lookup for this request.

# don't cache static content...
if( $staticcontent ) { http.cache.disable(); }
See also: http.cache.enable, http.cache.setkey

http.cache.enable()

Performs the opposite function to http.cache.disable(), and re-enables the default caching behaviour when the dynamic caching option in the virtual server is enabled.

# only cache what we explicitly enable
http.cache.disable(); # turn off everything
if( $agent == "googlebot" || $is_app1 ) {
   http.cache.enable();
}
See also: http.cache.disable, http.cache.setkey

http.cache.exists( [poolname] )

Returns 1 if the current request can (currently) be responded to from the cache, otherwise 0.
Note that even if the request is in the cache at the time of this call, it may be removed from the cache by the time that TrafficScript processing has finished and the traffic manager can send it. If a cached response must be guaranteed, http.cache.respondIfCached() should be used.
A pool name can be provided as optional argument in order to make the lookup use the specified pool. Without this argument, the lookup will use the pool previously selected with pool.select or the virtual server's default pool.
This function always returns 0 if called in a response rule.

# Use a rate class only if the page is going to be
# served from the backend.
if( !http.cache.exists() ) {
   # The page cannot be served from the cache.
   # The traffic manager will have to get the page
   # from a back-end server, so rate-limit the
   # connection:
   rate.use( "rate" );
}
See also: http.cache.enable, http.cache.disable, http.cache.respondIfCached, pool.select

http.cache.respondIfCached( [poolname] )

Sends a cached response to the client without any further rule processing and without connecting to a back-end server. If no match is found in the cache or if the request does not allow cached responses, rule processing continues normally. If the response can be served from the cache, no statements after this function call will be processed and the client will get the cached page.
A pool name can be provided as optional argument in order to make the lookup use the specified pool. Without this argument, the lookup will use the pool previously selected with pool.select or the virtual server's default pool.
This function does nothing if called in a response rule.

# Use a rate class only if the page is going to be
# served from the backend.
http.cache.respondIfCached();
#
# If we get here, the page could not be served
# from the cache. The traffic manager will have
# to get the page from a back-end server, so
# rate-limit the connection:
rate.use( "rate" );
See also: http.cache.enable, http.cache.disable, http.cache.exists, pool.select

http.cache.setkey( key )

Allows multiple variants of the same URL to be considered distinct objects, even if the standard 'Vary' RFC semantics would consider the pages identical. Cached objects will be stored with this key, and subsequent requests for the same URL will only match if the same key is provided. An example use is to provided different cached content based on a portion of the User-Agent field of the request. Note that successive uses of this function will overwrite the previous use rather than append the new key to it.

# internal/external users see different pages
http.cache.setkey( $am_internal_user );
See also: http.cache.enable, http.cache.disable

http.compress.disable()

Stops this HTTP response from being compressed. This function overrides the Virtual Server Content Compression settings, so this is useful for stopping particular MIME types for certain browsers from being compressed.

# Don't compress text/css pages
if( $contenttype == "text/css" ) {
    http.compress.disable();
}
See also: http.compress.enable

http.compress.enable()

Allows this individual HTTP response to be compressed. If this function is called for an HTTP response, then the Virtual Server settings for Content Compression are ignored, and the response will be compressed, assuming that the client supports compression. This function return 0 if it successfully enables compression

# Compress all text pages for Gecko
if( string.startswith( $contenttype, "text/" ) &&
    string.contains( $useragent, "Gecko" ) ) {

    http.compress.enable();
}
See also: http.compress.disable

http.request.delete( url, [ headers ], [ timeout ] )

Issues an HTTP DELETE request for a remote web page. $1 is set to the HTTP response code (e.g. 204 for OK), or is 0 if there was an error. $2 is set to the Content-Type of the response (or an error message if there was an error). $3 is set to the content-headers of the response, in the format: [<header-line>\r\n]*. $4 is set to the first line of the HTTP response. The entire original response may be reconstructed as $4."\r\n".$3."\r\n".$body, where $body is the result of http.request.get.
HTTPS pages can be requested by using the https:// prefix for the url.
A timeout parameter can be given (in seconds). If the request does not complete in this time, then an error will be given instead.
Requests made with http.request.delete() will use keepalive connections to the destination server. Provided the request was completed successfully, these keepalive connections will be re-used by any invocation of http.request.delete(), http.request.head() or http.request.get() to the same destination host:port, from any rule, in any virtual server. If the request is to a node in a pool, the connection will be shared with other requests your traffic manager makes to the same node. If the request made with http.request.delete() was unsuccessful, your traffic manager closes the connection.

# Delete a resource from the server
$book_id = http.getHeader( "X-Book-ID" );
http.request.delete( "http://www.example.com/books/"
                    . $book_id );
if( $1 != 204 ) {
   http.sendResponse( $1, "text/plain", "",
      "Could not delete book " . $book_id );
}
See also: http.request.get, http.request.post, http.request.put, http.request.head

http.request.get( url, [ headers ], [ timeout ] )

Issues an HTTP request for a remote web page and returns the body of the page requested. $1 is set to the HTTP response code (e.g. 200 for OK), or is 0 if there was an error. $2 is set to the Content-Type of the response (or an error message if there was an error). $3 is set to the content-headers of the response, in the format: [<header-line>\r\n]*. $4 is set to the first line of the HTTP response. The entire original response may be reconstructed as $4."\r\n".$3."\r\n".$body, where $body is the result of http.request.get.
HTTPS pages can be requested by using the https:// prefix for the url.
A timeout parameter can be given (in seconds). If the request does not complete in this time, then an error will be given instead.
Requests made with http.request.get() will use keepalive connections to the destination server. Provided the request was completed successfully, these keepalive connections will be re-used by any invocation of http.request.get() or http.request.head() to the same destination host:port, from any rule, in any virtual server. If the request is to a node in a pool, the connection will be shared with other requests your traffic manager makes to the same node. If the request made with http.request.get() was unsuccessful, your traffic manager closes the connection.

$body = http.request.get( "https://www.example.com/",
   "Cookie: foo=bar" );
if( $1 ) {
   http.sendResponse( $1, $2, $body, "" );
} else {
   log.info( "An error occurred: " . $2 );
}
See also: http.request.ssl.get, http.request.head, http.request.post, http.request.put, http.request.delete

http.request.head( url, [ headers ], [ timeout ] )

Issues an HTTP HEAD request for a remote web page. $1 is set to the HTTP response code (e.g. 200 for OK), or is 0 if there was an error. $2 is set to the Content-Type of the response (or an error message if there was an error). $3 is set to the content-headers of the response, in the format: [<header-line>\r\n]*. $4 is set to the first line of the HTTP response. The entire original response may be reconstructed as $4."\r\n".$3."\r\n".$body, where $body is the result of http.request.get.
HTTPS pages can be requested by using the https:// prefix for the url.
A timeout parameter can be given (in seconds). If the request does not complete in this time, then an error will be given instead.
Requests made with http.request.head() will use keepalive connections to the destination server. Provided the request was completed successfully, these keepalive connections will be re-used by any invocation of http.request.head() or http.request.get() to the same destination host:port, from any rule, in any virtual server. If the request is to a node in a pool, the connection will be shared with other requests your traffic manager makes to the same node. If the request made with http.request.head() was unsuccessful, your traffic manager closes the connection.

# Check that this site is working
http.request.head( "http://www.example.com/" );
if( $1 != 200 ) {
   pool.use( "Backup site" );
}
See also: http.request.get, http.request.post, http.request.put, http.request.delete

http.request.post( url, POST data, [ headers ], [ timeout ] )

Issues an HTTP POST request for a remote web page, and returns the body of the page requested. $1 is set to the HTTP response code (e.g. 200 for OK), or is 0 if there was an error. $2 is set to the Content-Type of the response (or an error message if there was an error). $3 is set to the content-headers of the response, in the format: [<header-line>\r\n]*. $4 is set to the first line of the HTTP response. The entire original response may be reconstructed as $4."\r\n".$3."\r\n".$body, where $body is the result of http.request.post.
HTTPS pages can be requested by using the https:// prefix for the url.
A timeout parameter can be given (in seconds). If the request does not complete in this time, then an error will be given instead.
Requests made with http.request.post() will always create a new connection to the destination server and will not use an existing connection. After a request made with http.request.post() has finished successfully, its connection can be re-used by any invocation of http.request.get() or http.request.head() to the same destination host:port, from any rule, in any virtual server. If the request was to a node in a pool, the connection will also be shared with other requests your traffic manager makes to the same node. If the request made with http.request.post() was unsuccessful, your traffic manager closes the connection.

$body = http.request.post("http://www.example.com/",
   "data",
   "Cookie: foo=bar\nContent-Type: text/plain" );
if( $1 ) {
   http.sendResponse( $1, $2, $body, "" );
}
See also: http.request.get, http.request.head, http.request.put, http.request.delete

http.request.put( url, PUT data, [ headers ], [ timeout ] )

Issues an HTTP PUT request for a remote web page, and returns the body of the page requested. $1 is set to the HTTP response code (e.g. 200 for OK), or is 0 if there was an error. $2 is set to the Content-Type of the response (or an error message if there was an error). $3 is set to the content-headers of the response, in the format: [<header-line>\r\n]*. $4 is set to the first line of the HTTP response. The entire original response may be reconstructed as $4."\r\n".$3."\r\n".$body, where $body is the result of http.request.put.
HTTPS pages can be requested by using the https:// prefix for the url.
A timeout parameter can be given (in seconds). If the request does not complete in this time, then an error will be given instead.
Requests made with http.request.put() will always create a new connection to the destination server and will not use an existing connection. After a request made with http.request.put() has finished successfully, its connection can be re-used by any invocation of http.request.get() or http.request.head() to the same destination host:port, from any rule, in any virtual server. If the request was to a node in a pool, the connection will also be shared with other requests your traffic manager makes to the same node. If the request made with http.request.put() was unsuccessful, your traffic manager closes the connection.

$body = http.request.put("http://www.example.com/",
   "data",
   "Cookie: foo=bar\nContent-Type: text/plain" );
if( $1 ) {
   http.sendResponse( $1, $2, $body, "" );
}
See also: http.request.get, http.request.head, http.request.post, http.request.delete

http.request.ssl.get( url, ca_certificates, [ headers ], [ timeout ] )

Issues an HTTPS request for a remote web page and returns the body of the page requested. Its behavior is identical to that of http.request.get when used with an HTTPS URL except for the following differences:

  1. The URL must start with 'https://', e.g https://www.iana.org, i.e. this function can only be used for secure communication.
  2. http.request.ssl.get will verify the server's certificate during the SSL Handshake. It will do so using the CA certificates provided in the second argument. This argument has to be an array of certificates. Certificates must be provided in PEM format. If one of the provided strings is not a valid certificate in PEM format, or if the array is empty, the function will fail. Therefore, verification of the peer's certificate is mandatory.
  3. Kept-alive connections are not re-used.

$issuer = '-----BEGIN CERTIFICATE-----
MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMA
kGA1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91
cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgMiBDZX
J0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYwMTU0Mzda
Fw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1
UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgG
A1UEChMRR29EYWRkeS5jb20sIEluYy4xMzAxBgNVBAsTKmh0dH
A6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9y
eTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmljYX
Rpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7D
I161+4WQFapmGBWTtwY6vj3D3HKrjJM9N55DrtPDAjhI6zMBS2
sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQmVZWt7/v+WI
bXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu7
5RpRSgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+
YlLpyo7RJlbmr2EkRTcDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1
NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ6qf9Z/dFjpfMFDniNo
W1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEuMB0G
A1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGD
AWgBTSxLDSkdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAG
AQH/AgEAMDMGCCsGAQUFBwEBBCcwJTAjBggrBgEFBQcwAYYXaH
R0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0fBD8wPTA7oDmg
N4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZX
Bvc2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAA
MDgwNgYIKwYBBQUHAgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ2
9kYWRkeS5jb20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCAQYw
DQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IGOgRQjh
VyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ
3kbTJSMUA2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5
CkKSkB2XIsKd83ASe8T+5o0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7
lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTXRE4+uXR21aITVS
zGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH
qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sg
VjOuH0aBsXBTWVU+4=
-----END CERTIFICATE-----';


$body = http.request.ssl.get(
                            "https://www.iana.org",
                            [ $issuer ]
                            );
if( $1 ) {
   http.sendResponse( $1, $2, $body, "" );
} else {
   log.info( "An error occurred: " . $2 );
}
See also: http.request.get

http.stream.continueFromBackend( [data] )

Stops streaming any data from the current rule and lets your traffic manager send remaining data from backend. The 'data' parameter can be used to send the last block to be streamed. Rule processing will finish and no further statements in this or subsequent rules will be executed. Unlike http.stream.finishResponse(), any data coming from the backend server will continue to be sent from the backend to the client normally.
Note that this function will behave exactly like http.stream.finishResponse() if run from a request rule.

http.stream.startResponse(
  "200", "text/html", "", "Server: Stingray");

while( 1 ) {
  # read full lines but at most 4k of data:
  $data = http.stream.readBulkResponse( 4096, "\n" );

  # No more data to read; break out of this loop
  if( 0 == string.length( $data ) ) {
    break;
  }

  if( string.find( $data, "foo" ) >= 0 ) {
     $data = string.replace( $data,"foo","bar" );
     # Job done, exit now. Any remaining body data
     # will continue to be sent from backend.
     http.stream.continueFromBackend( $data );
  }

  # stream data to client if not found.
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.startResponse, http.stream.readBulkResponse, http.stream.readResponse, http.stream.writeResponse, http.stream.finishResponse

http.stream.finishResponse( [data] )

Indicates that 'data' is the last block to be streamed for the current transaction. Rule processing will stop after http.stream.finishResponse() has been called, i.e. the remaining statements of the present rule will not be evaluated and no subsequent rules will be run.

http.stream.startResponse(
  "200", "text/html", "", "Server: Stingray");

while( 1 ) {
  # read full lines but at most 4k of data:
  $data = http.stream.readBulkResponse( 4096, "\n" );
  if( $data == "" )
    break; # server has finished the response
  # invert server's logic:
  $data = string.replaceAllI( $data, "yes", "no" );
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.startResponse, http.stream.readBulkResponse, http.stream.readResponse, http.stream.writeResponse, http.sendResponse

http.stream.readBulkResponse( count, [delimiter] )

Reads (and consumes) data from the server, so that TrafficScript can manipulate the data and send a modified version to the client.
Reads the number of bytes specified by 'count' from the body of the HTTP response supplied by the server. Data from the response is only returned up to and including the last occurrence of 'delimiter' if a non-empty delimiter has been specified. Unlike http.getResponseBody(), it also removes the data returned from the server's response. When the end of the response from the server has been reached, an empty string is returned.
If the delimiter partially matches at the end of the specified number of bytes, the data returned will include the full delimiter (thus returning slightly more data than specified). If the delimiter is not found in the specified number of bytes, then the specified number of bytes of data will be returned.

# Stream a HTTP response back, changing the content
# as it is read in.
http.stream.startResponse(
  "200", "text/html", "", "Server: Stingray" );

while( 1 ) {
  # read several full lines but at most 4k of data:
  $data = http.stream.readBulkResponse( 4096, "\n" );
  if( $data == "" )
    break; # server has finished the response
  # invert server's logic:
  $data = string.replaceAllI( $data, "yes", "no" );
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.readResponse, http.getResponseBody, http.stream.writeResponse, http.stream.finishResponse, http.stream.startResponse

http.stream.readResponse( count, [delimiter] )

Similar to http.stream.readBulkResponse(), but only returns response body data up to and including the first occurrence of delimiter. The two functions behave identically if no delimiter is provided.

http.stream.startResponse(
  "200", "text/html", "", "Server: Stingray" );

while( 1 ) {
  # read full line but at most 4k of data:
  $data = http.stream.readResponse( 4096, "\n" );
  if( $data == "" )
    break; # server has finished the response
  # invert server's logic:
  $data = string.replaceAllI( $data, "yes", "no" );
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.readBulkResponse, http.getResponseBody, http.stream.writeResponse, http.stream.finishResponse, http.stream.startResponse

http.stream.startResponse( resp_code, content_type, [content_length, headers] )

Sets up an HTTP response from which data can be streamed later by calling http.stream.writeResponse(). http.stream.startResponse() can only be called once per HTTP transaction. Only 'resp_code' and 'content_type' are mandatory arguments. However, it is recommended to specify the 'content_length' if possible. If it is provided and a valid integer, your traffic manager will not stream more than that number of bytes. A set of headers (separated by "\r\n") can be provided in the optional fourth argument. In a response rule, if no fourth argument is given, the response headers from the back-end will be sent on to the client (note, however, that your traffic manager may override some of these headers, e.g. the 'Connection' header)

http.stream.startResponse(
  "200", "text/html", "",
  "Server: Stingray\r\nX-Hello: World");

while( 1 ) {
  # read full lines but at most 4k of data:
  $data = http.stream.readBulkResponse( 4096, "\n" );
  if( $data == "" )
    break; # server has finished the response
  # invert server's logic:
  $data = string.replaceAllI( $data, "yes", "no" );
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.writeResponse, http.stream.finishResponse, http.stream.readBulkResponse, http.stream.readResponse, http.sendResponse

http.stream.writeResponse( data )

Sends the data in the 'data' argument to the client. http.stream.writeResponse() can be called multiple times but http.stream.startResponse() must have been called beforehand.

http.stream.startResponse(
  "200", "text/html", "", "Server: Stingray");

while( 1 ) {
  # read full lines but at most 4k of data:
  $data = http.stream.readBulkResponse( 4096, "\n" );
  if( $data == "" )
    break; # server has finished the response
  # invert server's logic:
  $data = string.replaceAllI( $data, "yes", "no" );
  http.stream.writeResponse( $data );
}

http.stream.finishResponse();
See also: http.stream.startResponse, http.stream.readBulkResponse, http.stream.readResponse, http.stream.finishResponse, http.sendResponse

java.run( Java Extension class name, [options] )

Runs a named Java Extension. The Java Extension class name must be given, and extra options can also be supplied to the Extensions. (These are supplied as the 'args' attribute in the Java Extension API).

java.run(
   "com.riverbed.UserVerify", $user, $password
);

json.deserialize( json_string )

Converts the supplied string in JavaScript Object Notation (JSON) into a TrafficScript array or hash variable. If the supplied string is not in the correct format then a warning will be printed and the result will be empty.

# Deserialising a JSON array
$json_array = '[ "element 1", "element 2" ]';
$array = json.deserialize( $json_array );

# Deserialising a JSON hash
$json_object = '{ "key 1":"value 1", \
                  "key 2":[ "array element" ] }';
$hash = json.deserialize( $json_object );
See also: json.serialize

json.serialize( object )

Converts the supplied array or hash variable into JavaScript Object Notation (JSON). This format is commonly used to exchange data between online applications.

# Serialising an array
$array = [ "element 1", "element 2" ];
$json_array = json.serialize( $array );

# Serialising a hash
$hash = [ "key 1" => "value 1",
          "key 2" => [ "array element" ] ];
$json_object = json.serialize( $hash );
See also: json.deserialize

lang.assert( condition, message )

If the condition is false, prints a warning to the log with the current line number and terminates the rule. If the condition is true then no messages will be printed and the rule will continue as normal.

# Make sure that this rule is only run with
# Virtual Servers that are using SSL Decryption.
lang.assert( ssl.isSSL(),
             "This rule should only be used \
              with decrypted SSL connections" );
See also: lang.warn

lang.chr( number )

Converts a number to the corresponding ASCII character. chr() may be used as an alias for lang.chr().

# Pick a random letter from A - Z
$char = lang.chr( math.random( 26 ) + 65 );
Alternate name: chr
See also: lang.ord

lang.dump( variable )

Converts the supplied variable into a human-readable string. This function is useful for printing the contents of arrays and hashes when debugging TrafficScript rules.

# Print the headers of the current HTTP request
log.info( lang.dump( http.getHeaders() ) );

lang.isarray( data )

Returns whether or not the supplied data is an array.

sub passMeAnArray( $array ) {
   # Test whether the supplied data is an array
   if( !lang.isArray( $array ) ) {
      return false;
   }
   # ...
}
See also: lang.ishash

lang.ishash( data )

Returns whether or not the supplied data is a hash.

sub passMeAHash( $hash ) {
   # Test whether the supplied data is a hash
   if( !lang.isHash( $hash ) ) {
      return false;
   }
   # ...
}
See also: lang.isarray

lang.max( param1, param2 )

Returns the maximum value of the two parameters provided. If both parameters are strings, it uses a string comparison; otherwise, the parameters are promoted to integers or doubles and compared. max() may be used as a shorthand for lang.max().

$r = lang.max( 9, 10 ); # returns 10
$s = lang.max( "9", "10" ); # returns "9"
$r = lang.max( 2, "4.8" ); # returns 4.8
Alternate name: max
See also: lang.min

lang.min( param1, param2 )

Returns the minimum value of the two parameters provided. If both parameters are strings, it uses a string comparison; otherwise, the parameters are promoted to integers or doubles and compared. min() may be used as a shorthand for lang.min().

$r = lang.min( 9, 10 ); # returns 9
$s = lang.min( "9", "10" ); # returns "10"
$r = lang.min( 2, "4.8" ); # returns 2
Alternate name: min
See also: lang.max

lang.ord( string )

Converts an ascii character to an integer. ord() may be used as a shorthand alias for lang.ord().

# Get the integer value of a character.
$val = lang.ord( "A" );
Alternate name: ord
See also: lang.toString, lang.chr

lang.toArray( values )

Returns an array of the supplied values.

$arr = lang.toArray( "10", "hello" );
See also: lang.toDouble, lang.toString, lang.toInt

lang.toDouble( value )

Returns the double (floating point) value of its parameter, using the TrafficScript type-casting rules.

$r = lang.toDouble( "3.14157" ); # returns 3.14157
$r = lang.toDouble( 10 ); # returns 10
$r = lang.toDouble( 3.14175 ); # returns 3.14175
$r = lang.toDouble( "!!!" ); # returns 0.0
Alternate name: toDouble
See also: lang.toInt, lang.toString

lang.toHash( values )

Returns an hash of the supplied key value pairs.

$hash = lang.toHash( "ten", 10, "eleven", 11 );
See also: lang.toDouble, lang.toString, lang.toInt, lang.toArray

lang.toInt( value )

Returns the integer value of its parameter, using the TrafficScript type-casting rules.

$r = lang.toInt( "10xxx" ); # returns 10
$r = lang.toInt( 3.14157 ); # returns 3
$r = lang.toInt( 10 ); # returns 10
$r = lang.toInt( "!!!" ); # returns 0
Alternate name: toInt
See also: lang.toDouble, lang.toString

lang.toString( value )

Returns the string value of its parameter, using the TrafficScript type-casting rules.

$s = lang.toString( 10 ); # returns "10"
$s = lang.toString( 3.14157 ); # returns "3.14157"
$s = lang.toString( "10" ); # returns "10"
Alternate name: toString
See also: lang.toInt, lang.toDouble, lang.chr, lang.ord

lang.tochar( number )

This function is an alias for lang.chr.

# Pick a random letter from A - Z
$char = lang.tochar( math.random( 26 ) + 65 );
Alternate name: tochar
See also: lang.chr

lang.warn( message )

Prints a warning to the log with the line number that this function call appears on. If strict error checking is enabled then the rule will abort.

$decoded = string.decrypt( $password, "passphrase" );
if( !$decoded ) {
   lang.warn( "Failed to decrypt string" );
} else {
   # String decrypt succeeded...
}
See also: lang.assert

log.error( message )

Writes an error message to the traffic managers's event log file. This log can be viewed through the UI.

log.error( "Insert coffee to continue" );
See also: log.info, log.warn, event.emit

log.info( message )

Writes an informational message to the traffic manager's event log file. This log can be viewed through the UI.

log.info( "Everything is OK" );
See also: log.warn, log.error, event.emit

log.warn( message )

Writes a warning message to the traffic manager's event log file. This log can be viewed through the UI.

log.warn( "There may be trouble ahead" );
See also: log.info, log.error, event.emit

math.acos( x )

Calculates the arc cosine of x and returns an angle in radians in the range 0 to pi.

$acos = math.acos( 0 ); # returns pi/2 (approx.)
Alternate name: acos
See also: math.cos

math.asin( x )

Calculates the arc sine of x and returns an angle in radians in the range -pi/2 to pi/2.

$asin = math.asin( 0 ); # returns 0 (approx.)
Alternate name: asin
See also: math.sin

math.atan( angle )

Calculates the arc tangent of x and returns an angle in radians in the range -pi/2 to pi/2.

$atan = math.atan( 0 ); # returns 0 (approx.)
Alternate name: atan
See also: math.tan

math.ceil( value )

Returns the smallest integer greater than or equal to its parameter.

$r = math.ceil( 6.28 ); # returns 7
$r = math.ceil( "4" ); # returns 4
Alternate name: ceil
See also: math.floor, math.rint, math.fabs

math.cos( angle )

Interprets its parameter as an angle in radians and returns its cosine.

$cos = math.cos( 6.28314 ); # returns 1 (approx.)
Alternate name: cos
See also: math.sin, math.tan

math.exp( power )

Calculates e raised to the power of its parameter and returns the result.

$r = math.exp( math.ln( 10 ) ); # returns 10
Alternate name: exp
See also: math.ln, math.pow

math.fabs( value )

Interprets its parameter as a floating point number and returns its absolute value.

$r = math.fabs( -6.28 ); # returns 6.28
Alternate name: fabs
See also: math.floor, math.ceil, math.rint

math.floor( value )

Returns the largest integer not greater than its parameter.

$r = math.floor( 4.001 ); # returns 4
$r = math.floor( 17 ); # returns 17
Alternate name: floor
See also: math.ceil, math.rint, math.fabs

math.ln( value )

Returns the natural logarithm of its parameter.

$ln = math.ln( 2.71828 ); # returns 1 (approximately)
Alternate name: ln
See also: math.log, math.exp

math.log( value )

Returns the base10 logarithm of its parameter.

$log = math.log( 100 ); # returns 2
Alternate name: log
See also: math.ln, math.pow

math.pow( num, power )

Raises its first parameter to the power of its second parameter and returns the result.

$r = math.pow( 2, 3 ); # returns 8
Alternate name: pow
See also: math.ln, math.exp, math.sqrt

math.random( range )

Returns a pseudorandom integer greater than or equal to zero, and less than its parameter.

# returns a value in the range 0 to 99
$rand = math.random( 100 );
Alternate name: random

math.rint( value )

Rounds its parameter by returning the integer closest to its value.

$r = math.rint( 4.25 ); # returns 4
$r = math.rint( 4.75 ); # returns 5
Alternate name: rint
See also: math.floor, math.ceil, math.fabs

math.sin( angle )

Interprets its parameter as an angle in radians and returns its sine.

$sin = math.sin( 6.28314 ); # returns 0 (approx.)
Alternate name: sin
See also: math.cos, math.tan

math.sqrt( num )

Returns the square root of its parameter.

$root = math.sqrt( 2 ); # returns 1.414 (approx.)

if( lang.toString( math.sqrt( $num ) ) == "nan" ) {
   # $num is negative or NaN ...
}
Alternate name: sqrt
See also: math.pow

math.tan( angle )

Interprets its parameter as an angle in radians and returns its tangent.

$tan = math.tan( 6.28314 ); # returns 0 (approx.)
Alternate name: tan
See also: math.sin, math.cos

net.dns.resolveHost( hostname )

Resolves a hostname into an IPv4 address, using the DNS name servers configured on the local system. If the lookup fails, an empty string is returned.

# Do a double-dns lookup
$rip = request.getRemoteIP();
$rhost = net.dns.resolveIP( $rip );
$ip = net.dns.resolveHost( $rhost );
if( $ip != $rip ) {
   log.warn( "Double lookup failed" );
}
See also: net.dns.resolveIP, net.dns.resolveHost6

net.dns.resolveHost6( hostname )

Resolves a hostname into an IPv6 address, using the DNS name servers configured on the local system. If the lookup fails, an empty string is returned.

# Do a double-dns lookup for an IPv6 address
$rip = request.getRemoteIP();
$rhost = net.dns.resolveIP( $rip );
$ip = net.dns.resolveHost6( $rhost );
if( $ip != $rip ) {
   log.warn( "Double lookup failed" );
}
See also: net.dns.resolveHost, net.dns.resolveIP

net.dns.resolveIP( IP address )

Resolves an IP address to a hostname, using the DNS name servers configured on the local system.
Returns a hostname, or the IP address if the address cannot be resolved. An empty string is returned if the parameter is not a valid IP address.

$rip = request.getRemoteIP();
$rhost = net.dns.resolveIP( $rip );
log.info( "Request from ".$rhost );
See also: net.dns.resolveHost, net.dns.resolveHost6

pool.activenodes( Pool )

Returns the number of nodes that are alive in the named pool. This will not include any nodes that have been marked as 'draining'.

# Throw a warning if the number of live nodes
# drops to below 3

if( pool.activeNodes( "database" ) < 3 ) {
   log.warn( "Database nodes are low" );
}

# If there are less than two nodes, use a different
# pool.
# Better to use priority nodes in a pool for this
# though.

if( pool.activeNodes( "database" ) < 2 ) {
   pool.use( "database-offsite" );
} else {
   pool.use( "database" );
}
See also: pool.listactivenodes, pool.failednodes

pool.checknode( Pool, Host, Port )

Query the pool to determine the status of a node. Will return one of : "NOTINPOOL","NOSUCHPOOL","NOSUCHHOST","DEAD" "ACTIVE","DISABLED","DRAINING"

$status = pool.checknode("FTP Server","app1",21);
if($status != "Active") {
   log.warn("FTP Server app1 unavailable ".$status);
}

pool.disablednodes( Pool )

Returns the number of nodes that are have been marked as disabled in the named pool.

# Log the number of disabled nodes
$nodes = pool.disabledNodes("mypool");
log.info($nodes." nodes are disabled");
See also: pool.activenodes, pool.listdisablednodes

pool.drainingnodes( Pool )

Returns the number of nodes that are draining in the named pool.

# Log connections to draining nodes

$pool = connection.getPool();
if( pool.drainingNodes( $pool ) ) {
   $node = connection.getNode();
   $ip_port = string.split( $node, ":" );
   if( pool.checknode( $pool,
                       $ip_port[0],
                       $ip_port[1] )
                           == "DRAINING" ) {
      log.info($node." is disabled");
   }
}
See also: pool.activenodes, pool.listdrainingnodes

pool.failednodes( Pool )

Returns the number of nodes that have failed in the named pool.

# Emit a warning if the number of failed nodes
# exceeds the number of active nodes.

if( pool.failedNodes( "database" ) >
    pool.activeNodes( "database" ) ) {
  event.emit( "warning", "Too many failed nodes" );
}
See also: pool.activenodes, pool.listfailednodes

pool.listactivenodes( Pool )

Lists the IP addresses of the nodes that are alive in the named pool. This will not include any nodes that have been marked as 'draining'.

# Post some data to every active node.
$nodes = pool.listActiveNodes("thepool");
foreach ( $node in $nodes ) {
   http.request.post("http://".$node."/someurl",
                     "1234");
}
See also: pool.listdrainingnodes, pool.listfailednodes, pool.listdisablednodes, pool.listallnodes

pool.listallnodes( Pool )

Lists the IP addresses of all the nodes including disabled nodes.

# Log every node we know about using port 1234
$nodes = array.filter( pool.listAllNodes("thepool"),
                       ":1234$" );
foreach ( $node in $nodes ) {
   log.info( "Found ".$node );
}
See also: pool.listactivenodes, pool.listdrainingnodes, pool.listfailednodes, pool.listdisablednodes

pool.listdisablednodes( Pool )

Lists the IP addresses of the nodes that are disabled in the named pool.

# Log every disabled node.
$nodes = pool.listDisabledNodes("thepool");
foreach ( $node in $nodes ) {
   log.warn( $node." is disabled" );
}
See also: pool.listactivenodes, pool.listdrainingnodes, pool.listfailednodes, pool.listallnodes

pool.listdrainingnodes( Pool )

Lists the IP addresses of the nodes that are draining in the named pool.

# Search for a node in the draining list
$nodes = pool.listDrainingNodes("thepool");
$mynode = connection.getNode();
if ( array.contains( $nodes, $mynode ) ) {
   log.info( $mynode." is draining" );
}
See also: pool.listactivenodes, pool.listdisablednodes, pool.listallnodes, pool.listallnodes

pool.listfailednodes( Pool )

Lists the IP addresses of the nodes that are marked as failed in the named pool.

# Log every failed node.
$nodes = pool.listFailedNodes("thepool");
foreach ( $node in $nodes ) {
   log.warn( $node." has failed" );
}
See also: pool.listactivenodes, pool.listdrainingnodes, pool.listdisablednodes, pool.listallnodes

pool.select( Pool, [ Host, Port ] )

Selects a pool to load-balance this connection with. By default, the pool name should be a literal string (i.e. not dynamically generated and not containing any variables), however, if you enable the "trafficscript!variable_pool_use" global setting variables can be used too. Please refer to the Troubleshooting section of the Stingray TrafficScript Overview and Reference Manual for more information about this setting. Unlike pool.use(), your traffic manager will continue to process further request rules after this function.
If the pool named does not exist, your traffic manager will log a warning message.
Optionally, a specific machine can be specified that will be used to forward the request on to. This machine does not have to be in the pool selected, or in fact in any pool. In this mode, the selected pool is used only for its configuration settings (e.g. timeout values, SSL encryption options, etc.)

# Use the pool named 'Content Pool'
pool.select( "Content Pool" );

# Send this request to www.riverbed.com:80,
# using config from pool 'Riverbed'
pool.select( "Riverbed", "www.riverbed.com", 80 );
See also: pool.use

pool.use( Pool, [ Host, Port ] )

Selects a pool to load-balance this connection with, and stops processing any more rules. It must only be used in request rules.
By default the pool name should be a literal string, however, if you enable the "trafficscript!variable_pool_use" global setting, variables can be used too. Please refer to the Troubleshooting section of the Stingray TrafficScript Overview and Reference Manual for more information about this setting.
If the pool named does not exist, your traffic manager will log a warning message and use the default pool configured for the virtual server.
Optionally, a specific machine can be specified that will be used to forward the request on to. This machine does not have to be in the pool selected, or in fact in any pool. In this mode, the selected pool is used only for its configuration settings (e.g. timeout values, SSL encryption options, etc.)

# Use the pool named 'Content Pool'
pool.use( "Content Pool" );

# Send this request to www.riverbed.com:80,
# using config from pool 'Stingray'
pool.use( "Stingray", "www.riverbed.com", 80 );
See also: pool.select

rate.getbacklog( class_name, [ context ] )

Returns the number of connections that are currently waiting to be released by the supplied rate class.

$backlog = rate.getbacklog( "gold-user",
                            request.getRemoteIP() );
if( $backlog > 10 ){
   # Tell the customer to come back later
   http.sendResponse( "503 Service Unavailable",
                      "text/html", "Go away",
                      "Retry-After: 10" );
}
See also: rate.use

rate.use( class_name, [ context ] )

Immediately queues a connection using the named rate class.
The connection and the current TrafficScript rule is stalled until the rate class releases it, according to the rate limits defined in the class. When the connection is released, the rate.use() function returns and the TrafficScript rule continues to execute.
If rate.use() is called with the optional 'context' value, it uses a new rate class which inherits all of the rate settings from the named rate class. All connections called with the same 'context' value use the same new rate class. This allows you to shape connections based on arbitary data, such as a user name or source IP address, shaping connections from different users or source IPs independently.
If the connection has passed through the class successfully then the value 1 is returned. If the connection times out while it is queued, then the TrafficScript rule is abandoned. If the connection could not be queued because an invalid rate class name was provided, rate.use() returns 0.

rate.use( "protect_database" );

rate.use( "limit_user",
          http.getCookie( "SessionID" ) );

rate.use.noQueue( class_name, [ context ] )

Checks if this connection will exceed the rate limits of the named rate class. If connection is within rate limits, a value of 1 is returned and the connection is added to rate usage data. If usage has exceeded rate limits, a value of 0 is returned. If the rate class does not exist, a value of -1 will be returned.
Optionally a context value can be used to check rate limits based on a context, for example, rate limits for a specific client IP address. See rate.use for more details on context.
Unlike rate.use(), this will not queue connections if the rate limit is exceeded.
Note that calling rate.use() after rate.use.noQueue() will mean that the connection is counted twice, halving the allowed rate.

$use = rate.use.noQueue( "protect_database" );
# usage is over rate limits.
if( $use == 0 ){
   http.sendResponse( "503 Service Unavailable",
                      "text/html", "Go away",
                      "Retry-After: 10" );
   connection.discard();
} else if( $use > 0 ){ # usage is within rate limits
   log.info( "No queueing" );
} else { # Rate class does not exist
   log.info( "Rate class doesn't exist" );
}
See also: rate.use

recentconns.exclude()

Specifies that this connection should not be saved in the Recent Connections buffer upon completion. This function can be used when the virtual server has recent_conns!save_all set to Yes to filter out unwanted connections from the Recent Connections page.
Note that recent_conns!enabled must be set to Yes on the virtual server for any connections to be saved.

# Don't bother saving connections that completed
# within 1 second and returned a 200.
if( http.getResponseCode() == 200
   && stats.getTransactionDuration() < 1000 ) {
   recentconns.exclude();
}
See also: recentconns.include, requestlog.exclude

recentconns.include()

Mark this connection for inclusion in the Recent Connections buffer. Details about this connection can then be viewed on the Activity > Connections page.
Note that recent_conns!enabled must be set to Yes on the virtual server for any connections to be saved.
Returns true if the connection will be added to the Recent Connections buffer, or false otherwise.

# Show server errors on the recent connections page
if( http.getResponseCode() >= 500 ){
   recentconns.include();
}
See also: recentconns.exclude, requestlog.include

recentconns.markedForInclusion()

Returns whether or not this connection will be added to the Recent Connections page upon completion.
Connections will be included on the Recent Connections page only if recent_conn!enabled is set to Yes for this virtual server and the connection has been marked for inclusion either by default, or by the recentconns.include() function.

# If this rule will be added to the recent
# connections page, add some additional info
if( recentconns.markedForInclusion() ) {
   # Add the user's name to the log
   $user = connection.data.get( "user" );
   http.addResponseHeader( "X-Username", $user );
}
See also: recentconns.include, recentconns.exclude, requestlog.markedForInclusion

request.avoidNode( node )

Indicates that the named node should be avoided if at all possible.
When picking a node to use for a request, the traffic manager will not use any nodes that have been named by request.avoidNode() unless session persistence mandates it, or unless there are no other nodes available.

# if we get a 503 Too Busy response, retry
if( http.getResponseCode() == 503 ) {
   if( request.getRetries() < 3 ) {
      request.avoidNode( connection.getNode() );
      request.retry();
   }
}
See also: request.retry, request.getRetries, connection.getNode

request.endsAt( offset )

Marks the end of the current request. Any more data read in from the network is not handled until the next request has started to be handled.
This function is useful to synchronise requests and responses. An example of its use would be for a line-oriented protocol such as POP3, where you wish to process each command.
It returns the entire request.
This function allows you to program layer-7 intelligence to correctly parse and manage generic TCP protocols.

# get one line from input
$req = request.getLine();

# this is the end of the current request
request.endsAt( string.len( $req ) );

# Note: request.endsAt will return the request,
# but we've already got this in $req
See also: request.endsWith

request.endsWith( regex )

Marks the end of the current request. Any more data read in from the network is not handled until the next request has started to be handled.
This function is useful to synchronise requests and responses. An example of its use would be for a line-oriented protocol such as POP3, where you wish to process each command.
It returns the entire request.
This function allows you to program layer-7 intelligence to correctly parse and manage generic TCP protocols.

# this is the end of the current request
$req = request.endsWith( "\n" );
See also: request.endsAt

request.get( [count] )

Returns the first 'count' bytes of data provided by the client in the current request. If no count parameter is provided, all data read so far is returned, which may be none unless request.get() has previously been called with a positive count. If you cannot determine how much data to read, use request.getLine or request.endsWith instead.
Warning: you can stall a connection by asking it to read more data than the remote client will provide. Combine this with request.getLength() or request.getLine() to reliably read data from a connection. For HTTP, you are required to use the HTTP specific functions like http.getBody() to read the request.

# Get a length
$buf = request.get( 4 );
$l = string.bytesToInt( $buf );
# Now we know how much more data to ask for
$data = request.get( 4 + $l );
See also: request.getLength, request.getLine, request.endsWith, request.set, response.get

request.getBandwidthClass()

Returns the current bandwidth class for the connection to the backend node, or an empty string if no class is set.

$class = request.getBandwidthClass();
See also: request.setBandwidthClass, response.setBandwidthClass, response.getBandwidthClass

request.getDSCP()

Returns the Differentiated Service Code Point (DSCP) field from the IP header of traffic being sent to the server. The return value is a either the DSCP value, or -1 if it could be not obtained from the socket. The return value is a 6-bit value.

if ( request.getDSCP() == 46 ) {
  log.info( "Processing Expedited traffic" );
  connection.setServiceLevelClass( "gold" );
}
See also: request.setDSCP, response.getDSCP, response.setDSCP

request.getDestIP()

Returns the original IP address that the client attempted to connect to. This will be the same as request.getLocalIP() unless the connection was redirected via firewall rules (e.g. using iptables on Linux)

# Get the local IP address, such as "10.1.4.21" or
# "2001:200::8002:203:47ff:fea5:3085"
$ip = request.getDestIP();
See also: request.getDestPort, request.getRemoteIP, request.getRemotePort

request.getDestPort()

Returns the original network port number that the client attempted to connect to. This will be the same as request.getLocalPort() unless the connection was redirected via firewall rules (e.g. using iptables on Linux)

# Get the port number on the traffic manager,
# such as 80
$port = request.getDestPort();
See also: request.getDestIP, request.getRemotePort, request.getRemoteIP

request.getLength()

Returns the number of bytes of data already received from the client. This can be combined with request.get() to reliably read data from a connection without stalling if no data is available.

$data = request.get( request.getLength() );
See also: request.get, response.getLength

request.getLine( [regex], [offset] )

Returns a line of request data provided by the client. The line is terminated by the supplied regular expression, or by '\n'. If 'offset' is provided, request.getLine() returns the data from that offset to the terminating expression. The terminating expression is included in the returned string.
When request.getline() returns, the variable $1 is updated to point to the start of the next line in the datastream.
You can iterate through the lines of request data by using $1 as the iterator variable.
To prevent excessive data usage, if the line ending is not found within trafficscript!memory_warning bytes (configurable on the Global Settings page), then that many bytes will be returned.

# Process the lines in the request until an empty
# line is found
$line = request.getLine( "\n" );
while( $line != "\n" ) {
   # process $line...
   $line = request.getLine( "\n", $1 );
}
See also: request.get, response.getLine

request.getLocalIP()

Returns the IP address that the client connected to, i.e. the address local to this machine.

# Get the local IP address, such as "10.1.4.21" or
# "2001:200::8002:203:47ff:fea5:3085"
$ip = request.getLocalIP();
See also: request.getLocalPort, request.getDestIP, request.getRemoteIP, request.getRemotePort, response.getLocalIP, response.getLocalPort, response.getRemoteIP, response.getRemotePort

request.getLocalPort()

Returns the network port number that the client connected to. (e.g. port 80 is normal for a web server)

# Get the local port, such as 80
$port = request.getLocalPort();
See also: request.getLocalIP, request.getRemotePort, request.getDestPort, request.getRemoteIP, response.getLocalPort, response.getLocalIP, response.getRemotePort, response.getRemoteIP

request.getLogEnabled() (deprecated)

Returns 1 if logging is enabled for this request, and 0 otherwise.

This function has been deprecated; requestlog.markedForInclusion should be used instead.

request.getMaxTransactionDuration()

Returns the current value of the allowed maximum duration for this transaction. If the duration has been set by a previous call to setMaxTransactionDuration, that value will be returned, otherwise the relevant virtual server's max_transaction_duration config key. A value of 0 means unlimited duration.

$max_duration = request.getMaxTransactionDuration();
if( $max_duration == 0 || $max_duration > 60 ) {
   # enforce absolute maximum for all requests:
   request.setMaxTransactionDuration( 60 );
}
See also: request.setMaxTransactionDuration, request.setVirtualServerTimeout, request.setMaxReplyTime

request.getRemoteIP()

Returns the remote IP address of the client.

# Get the remote IP address, such as "10.1.4.21"
# or "2001:200::8002:203:47ff:fea5:3085"
$ip = request.getRemoteIP();
See also: request.getRemotePort, request.getLocalIP, request.setRemoteIP, request.getLocalPort, response.getRemoteIP, response.getRemotePort, response.getLocalIP, response.getLocalPort

request.getRemotePort()

Returns the remote network port of the client's connection.

# Get the remote port, such as 20427
$port = request.getRemotePort();
See also: request.getRemoteIP, request.getLocalPort, request.getLocalIP, response.getRemotePort, response.getRemoteIP, response.getLocalPort, response.getLocalIP

request.getRetries()

Returns the number of times that this request has been explicitly retried by request.retry().

$code = http.getResponseCode();
if( $code == 404 || $code >= 500 ) {
  if( request.getRetries() < 3 ) {
    # Avoid the current node when we retry,
    # if possible
    request.avoidNode( connection.getNode() );
    request.retry();
  } else {
    http.sendResponse( "302 Redirect",
      "text/plain", "", "Location: /" );
  }
}
See also: request.retry, request.isResendable, pool.select

request.getToS() (deprecated)

NOTE: RFC 2474 has superceded IP ToS values with the DSCP field. Returns the Type of Service (ToS) of traffic going to the server. The return value is either "LOWDELAY", "THROUGHPUT", "RELIABILITY" or "NONE".

This function has been deprecated; request.getDSCP should be used instead.

request.isResendable()

Test if it is possible to resend this request to a different node. It is only possible to resend a request if the entire request has been buffered up in the traffic manager, for example, by explicitly reading it in a request rule.
If the request was streamed through to the client, for example, as a large HTTP POST, it will not have been buffered and therefore cannot be resent.
Note that request.isResendable detects if it is possible to resend a request; request.setIdempotent can be used to tell the traffic manager not to automatically resend a request if it fails.

if( request.isResendable() ) {
   log.info( "Retrying request" );
   request.retry();
}
See also: request.retry, request.getRetries, request.setIdempotent

request.retry()

Retry the request (using the currently selected pool). Load-balancing and session persistence decisions are recalculated, and the request is resubmitted - possibly to the same node as previously, although request.avoidNode() can prevent this.
If request.retry() is called, any request rules are not run again. When a new response is collected after request.retry(), the response rules are run again.
The response rule can modify the request in before resubmitting it.
It is only generally possible to resend a request if the entire request was read before the request rules completed. Otherwise, request data will have been streamed to the server and not cached. Use request.isResendable() to test for this.
request.getRetries() returns the number of times this request has already been tried.
On success, request.retry() does not return, but the response rules will be run again on the new response. On failure, request.retry() returns 0. request.retry() will do nothing if used in a request rule.

$code = http.getResponseCode();
if( $code == 404 || $code >= 500 ) {
  if( request.getRetries() < 3 ) {
    # Avoid the current node when we retry,
    # if possible
    request.avoidNode( connection.getNode() );
    request.retry();
  } else {
    http.sendResponse( "302 Redirect",
      "text/plain", "", "Location: /" );
  }
}
See also: request.isResendable, request.getRetries, pool.select

request.sendResponse( Data )

Writes the provided data directly back to the client.
Any data that has been read is discarded, and nothing is forwarded to the back-end node. Unlike its counterpart http.sendRequest(), this function does not terminate rule processing immediately. Instead, it stores the provided string for sending back to the client when rule processing has finished.
If you are managing HTTP traffic the http.sendResponse() function should be used instead.

# Send a response
request.sendResponse( "530 Login incorrect\r\n" );
See also: connection.discard, http.sendResponse, response.set, response.append, connection.close

request.set( request data )

Replaces the input data read from the client with the provided string.
This is a low-level routine that should be used with care. For protocols with their own higher-level protocol managers (e.g. HTTP), use the higher level routines to alter the input data (e.g. http.setHeader() and http.setBody()).

$data = request.get();
$data = string.regexsub( $data, "From", "To", "g" );
request.set( $data );
See also: request.get, response.set

request.setBandwidthClass( name )

Sets the bandwidth class for the current connection to the backend node. Providing an empty class name removes the bandwidth class from the connection. It returns zero if an error occurs (for example, if the bandwidth class does not exist), and 1 otherwise.

request.setBandwidthClass( "gold customers" );
See also: request.getBandwidthClass, response.setBandwidthClass, response.getBandwidthClass

request.setDSCP( 6-bit DSCP field )

Sets the Differentiated Service Code Point (DSCP) field in the IP packet header of traffic being sent to the server. A 6-bit value must be provided. If successful, this function returns true, otherwise it returns false. DSCP fields can be used by network equipment to change how they route network traffic.

if ( http.getHeader( "X-Set-DSCP-Priority" != "" )) {
   request.setDSCP( 0x2c );
}
See also: request.getDSCP, response.getDSCP, response.setDSCP

request.setIdempotent( resend )

Marks a request as resendable or non-resendable.
An idempotent request has no detrimental side effects, so it can safely be attempted multiple times. A non-idempotent request has a side effect - for example, it may update a database, or initiate a purchase.
By default, all non-HTTP requests are marked as idempotent. If a back-end node fails to generate a correct response when a request is initially forwarded to it, an attempt will be made to resend the request to another node. An exception to this is requests received through a virtual server using one of the generic-type protocols. In order to be idempotent by default, an end-point to the request must first be defined (using functions such as request.endsWith() or request.endsAt()). Only then can failures be measured and alternative nodes tried.
request.setIdempotent() can override this behaviour. If 'resend' is zero, this indicates that the request should only be attempted against one back-end node.
If 'resend' has a non-zero value, this indicates that if a request is made to a back-end node and a correct response is not received, the request should be retried against another back-end node.
Note that a request cannot be resent once it has begun streaming data between the client and the node. Additionally, UDP connections cannot be marked as resendable (the UDP client application should handle failed UDP responses).

# Mark this request as resendable
request.setIdempotent( 1 );
See also: http.setIdempotent

request.setLogEnabled( enabled ) (deprecated)

Enables or disables logging for the current request. Note that if logging for the current virtual server is disabled, then this function cannot currently enable it.
Returns 1 if logging is now enabled, and 0 if it is now disabled.

This function has been deprecated; requestlog.include should be used instead.

request.setMaxConnectionAttempts( int )

Overrides the pool's maximum number of connection attempts for this request. Connections to different nodes will be attempted until the maximum number of attempts is exceeded or the connection is successful. A value of 0 means unlimited attempts.

if( http.getMethod() == "POST" ) {
   # This is the same as request.setIdempotent( 0 )
   request.setMaxConnectionAttempts( 1 );
}
See also: request.setMaxReplyTime, request.setMaxTimedOutConnectionAttempts

request.setMaxReplyTime( seconds )

Overrides the pool's max reply time for this request, also overriding the virtual server timeout if necessary. A node must start its reply within this time or it will be timed out.

if( http.getMethod() == "POST" ) {
   # Allow more time to send data to server.
   request.setMaxReplyTime( 60 );
}
See also: request.setVirtualServerTimeout

request.setMaxTimedOutConnectionAttempts( int )

Overrides the pool's maximum number of timed-out connection attempts for this request. If the connection to the node fails due to max_reply_time being exceeded, connections to other nodes will be attempted until the maximum number of attempts is exceeded or the connection is successful. A value of 0 means unlimited attempts.

if( http.getMethod() == "POST" ) {
   request.setMaxTimedOutConnectionAttempts( 2 );
}
See also: request.setMaxConnectionAttempts

request.setMaxTransactionDuration( int )

Overrides the virtual server's maximum duration for this transaction. A value of 0 means unlimited duration.

$ct_len = http.getHeader( "Content-Length" );
if( $ct_len > 1024 ) {
   # give client 10s per kB of uploaded body data
   $d = 10 * $ct_len / 1024;
   request.setMaxTransactionDuration( $d );
} else {
   # use virtual server default
}
See also: request.getMaxTransactionDuration, request.setVirtualServerTimeout, request.setMaxReplyTime

request.setRemoteIP( ipAddr )

Sets the remote IP address of the client. This function should be used with care, as it will alter what is logged in request logs and the address seen by a back-end node in 'transparent' mode. 0 is returned if the IP address is invalid, and 1 otherwise.

# Set the remote IP address, such as "10.1.4.21"
request.setRemoteIP( "10.1.4.21" );
request.setRemoteIP( "2001:200::3085" );
See also: request.getRemoteIP

request.setToS( Type of Service ) (deprecated)

NOTE: RFC 2474 has superceded IP ToS values with the DSCP field. Sets the Type of Service (ToS) flags of traffic going to the server. Valid options are "LOWDELAY", "THROUGHPUT", "RELIABILITY" or "NONE". ToS flags may be used by network equipment to change how they route network traffic.

This function has been deprecated; request.setDSCP should be used instead.

request.setVirtualServerTimeout( seconds )

Overrides the virtual server's timeout for this request. The connection to the client will be closed after this period of time, regardless of what state it is in.

$path = http.GetPath();
if( string.startsWith( $path, "/downloads" ) ) {
   request.setVirtualServerTimeout( 60 );
}
See also: request.setMaxReplyTime

request.skip( count )

Removes the specified number of bytes from the start of the request provided by the client. This can be used in combination with request.get() and request.getLine() to stream data from a client, or to alter a request before passing it on to a server.
Successive calls to this function will remove further data.

# Skip the first 1K of data
request.skip( 1024 );

# Now skip another 1K
request.skip( 1024 );
See also: request.getLength, request.getLine, request.set, request.get

requestlog.exclude()

Specifies that this connection should not be written to the request log upon completion. This function can be used when the virtual server has log!save_all set to Yes to filter out unwanted connections from the request log.
Note that log!enabled or syslog!enabled must be set to Yes on the virtual server for any connections to be logged.

# Don't log requests from local IP addresses.
$ip = request.getRemoteIP();
if( string.ipmaskmatch( $ip, "10.0.0.0/8" ) ) {
   requestlog.exclude();
}
See also: requestlog.include, recentconns.exclude

requestlog.include()

Mark this connection to be added to the request log for this virtual server when it has completed.
Note that log!enabled or syslog!enabled must be set to Yes on the virtual server for any connections to be logged.
Returns true if the connection will be logged, or false otherwise.

# Record when the server is particularly slow to
# respond to a request
if( stats.getServerResponseTime() > 5000 ){
   requestlog.include();
}
See also: requestlog.exclude, recentconns.include

requestlog.markedForInclusion()

Returns whether or not this connection will be written either to the disk-based request log or to the remote syslog upon completion.
Connections will be written to the request log only if log!enabled or syslog!enabled is set to Yes for this virtual server and the connection has been marked for inclusion either by default, or by the requestlog.include() function.

if( requestlog.markedForInclusion() ) {
   http.addResponseHeader( "X-Logged", "Yes" );
}
See also: requestlog.include, requestlog.exclude, recentconns.markedForInclusion

resource.exists( filename )

Checks whether or not the named file exists in ZEUSHOME/zxtm/conf/extra/. If it exists 1 is returned, 0 otherwise.

# Test if the file exists
if( resource.exists( "myfile" ) ) {
   # ... process resource
}
See also: resource.get, resource.getMD5

resource.get( filename )

Returns the contents of a named file stored in the ZEUSHOME/zxtm/conf/extra/ directory. If the file doesn't exist, then an empty string is returned. Note that subdirectories of conf/extra are not supported.
Resources are pre-loaded into memory, so this call does not cause the file to be reloaded.

# Read the contents of the 'info' file and add them
# as a new header.
http.addheader( "X-Info", resource.get( "info" ));

resource.getLines( filename )

Returns the contents of a named file stored in the ZEUSHOME/zxtm/conf/extra/ directory as an array. If the file doesn't exist, then an empty array is returned. Note that subdirectories of conf/extra are not supported.
Resources are pre-loaded into memory, so this call does not cause the file to be reloaded.

# Read the contents of the 'info' file and add
# process them line-by-line
$info = resource.getLines( "info" );
foreach( $line in $info ) {
   # ...
}

resource.getMD5( filename )

Returns the MD5 of the current contents of the file in ZEUSHOME/zxtm/conf/extra/. If the file doesn't exist, an empty string is returned.
File MD5s are cached to speed up this call.

# Get the MD5 of the file
$md5 = resource.getMD5( "myfile" );
See also: resource.exists, resource.get

resource.getMTime( filename )

Returns the time that the named file in ZEUSHOME/zxtm/conf/extra/ was last modified, in seconds since the epoch (i.e. UNIX time). If the file doesn't exist, 0 is returned.

# Find out the time the file was last modified
$mtime = resource.getMTime( "myfile" );
See also: resource.exists, resource.get, resource.getMD5, sys.timeToString, sys.time

response.append( response data )

Appends the provided string to the response data.
This is a low-level routine that should be used with care. For protocols with their own higher-level protocol managers (e.g. HTTP), you must use the higher level routines to alter the input data (e.g. http.setResponseHeader() and http.setResponseBody()).

response.append(
   "I always have to have the last word." );
See also: response.set

response.close()

Immediately closes the connection to the back-end node. Any response data that has already been read from the server will be forwarded to the client, but no more response data will be read.
Your traffic manager will reconnect to a back-end node when it next needs to forward request data to it; the back-end node is specified by either calling pool.use() or pool.select() in a request rule, or by the default pool.

if( $neednewnode ) {
   response.close();
   pool.use( "servers" );
}
See also: connection.close, connection.discard, pool.use, pool.select

response.flush( count )

Transfers the first count bytes of the response back to the client. These bytes are removed from the underlying response buffer. If count is not specified, all current response data is flushed.
This function is useful in generic client- and server-first protocols, to synchronise responses with the next request. This may be necessary if your traffic manager is likely to respond directly to some requests, and the back-end node responds to others.

# keep flushing response data until we get
# an empty line...

$res = response.getLine();

while( $res != "\n" ) {
   response.flush( string.len( $res ) );
   $res = response.getLine();
}

# the remainder of the response buffer will be
# flushed when all response rules complete
See also: response.get, response.getLine

response.get( [count] )

Returns the first 'count' bytes of data provided by the server in the current response. If you do not supply a count parameter, then the entire response will be read in.
Warning: you can stall a connection by asking it to read more data than the back-end server will provide. Combine this with response.getLength() or response.getLine() to reliably read data from a connection. For HTTP, you must use the HTTP specific functions like http.getResponseBody() to read the response.

# Get the first 1K of data
$data = response.get( 1024 );
See also: response.getLength, response.getLine, response.set, request.get

response.getBandwidthClass()

Returns the current bandwidth class for the connection to the client, or an empty string if no class is set.

$class = response.getBandwidthClass();
See also: response.setBandwidthClass, request.setBandwidthClass, request.getBandwidthClass

response.getDSCP()

Returns the Differentiated Service Code Point (DSCP) field from the IP header of traffic being sent to the client. The return value is a either the DSCP value, or -1 if it could be not obtained from the socket. The return value is a 6-bit value.

if ( response.getDSCP() == 46 ) {
  log.info( "Processing Expedited traffic" );
  connection.setServiceLevelClass( "gold" );
}
See also: response.setDSCP, request.getDSCP, request.setDSCP

response.getLength()

Returns the amount of data already received from the server. This can be combined with response.get() to reliably read data from a connection without stalling if no data is available.

$data = response.get( response.getLength() );
See also: response.get, request.getLength

response.getLine( [regex], [offset] )

Returns a line of response data provided by the server. The line is terminated by the supplied regular expression, or by '\n'. If 'offset' is provided, response.getLine() returns the data from that offset to the terminating expression.
When response.getLine() returns, the variable $1 is updated to point to the start of the next line in the datastream.
You can iterate through the lines of response data by using $1 as the iterator variable.

# Process the lines in the response until an empty
 # line is found
 $line = response.getLine( "\n" );
 while( $line != "\n" ) {
    # process $line...
    $line = response.getLine( "\n", $1 );
 }
See also: response.get, request.getLine

response.getLocalIP()

Returns the local IP address of the connection to the node in use, i.e. an IP address on the local machine that your traffic manager connected from. It returns the empty string if no connection exists.

# Find the IP address we connected from, such as
# "10.1.4.21" or "2001:200::8002:203:30:40:3085"
$ip = response.getLocalIP();
See also: response.getLocalPort, response.getRemoteIP, response.getRemotePort, request.getLocalIP, request.getLocalPort, request.getRemoteIP, request.getRemotePort

response.getLocalPort()

Returns the local port of the connection to the node in use, i.e. the port number on the local machine that the traffic manager connected from. It returns 0 if there is no current connection to a node.

$port = response.getLocalPort();
See also: response.getLocalIP, response.getRemotePort, response.getRemoteIP, request.getLocalPort, request.getLocalIP, request.getRemotePort, request.getRemoteIP

response.getRemoteIP()

Returns the remote IP address of the node used. If there is no current connection, it will return an empty string.

# Get the IP address of the node used, such as
# "10.1.4.21" or "2001:200::8002:203:a:1:3085"
$ip = response.getRemoteIP();
See also: response.getRemotePort, response.getLocalIP, response.getLocalPort, request.getRemoteIP, request.getRemotePort, request.getLocalIP, request.getLocalPort

response.getRemotePort()

Returns the network port number on which the traffic manager connected to a node. (e.g. port 80 is normal for a web server). If there is no current connection, it will return 0.

$port = response.getRemotePort();
See also: response.getRemoteIP, response.getLocalPort, response.getLocalIP, request.getRemotePort, request.getRemoteIP, request.getLocalPort, request.getLocalIP

response.getToS() (deprecated)

NOTE: RFC 2474 has superceded IP ToS values with the DSCP field. Returns the Type of Service (ToS) of traffic going to the client. The return value is either "LOWDELAY", "THROUGHPUT", "RELIABILITY" or "NONE".

This function has been deprecated; response.getDSCP should be used instead.

response.set( response data )

Sets the server response to the provided string.
This is a low-level routine that should be used with care. For protocols with their own higher-level protocol managers (e.g. HTTP), you must use the higher level routines to alter the input data (e.g. http.setResponseHeader() and http.setResponseBody()).

$data = response.get();
$data = string.regexsub( $data,
   "From: ", "To: ", "g" );
response.set( $data );
See also: request.sendResponse, response.append, response.get, request.set

response.setBandwidthClass( name )

Sets the bandwidth class for the current connection to the client. Providing an empty class name removes the bandwidth class from the connection. It returns zero if an error occurs (for example, if the bandwidth class does not exist), and 1 otherwise.

response.setBandwidthClass( "gold customers" );
See also: response.getBandwidthClass, request.getBandwidthClass, request.setBandwidthClass

response.setDSCP( 6-bit DSCP field )

Sets the Differentiated Service Code Point (DSCP) field in the IP packet header of traffic being sent to the client. A 6-bit value must be provided. If successful, this function returns true, otherwise it returns false. DSCP fields can be used by network equipment to change how they route network traffic.

if ( http.getHeader( "X-Set-DSCP-Priority" != "" )) {
   response.setDSCP( 0x2c );
}
See also: response.getDSCP, request.setDSCP, request.getDSCP

response.setToS( Type of Service ) (deprecated)

NOTE: RFC 2474 has superceded IP ToS values with the DSCP field. Sets the Type of Service (ToS) flags of traffic going to the client. Valid options are "LOWDELAY", "THROUGHPUT", "RELIABILITY" or "NONE". ToS flags may be used by network equipment to change how they route network traffic.

This function has been deprecated; response.setDSCP should be used instead.

rtsp.addRequestHeader( name, value )

Adds an RTSP header. If the header already exists, via a case-insensitive lookup, this value will be appended to the existing value.

# Add a transport header
$my_header = "RTP/AVP/TCP; interleaved=0-1";
rtsp.addRequestHeader( "Transport", $my_header );
See also: rtsp.setRequestHeader, rtsp.getRequestHeader, rtsp.removeRequestHeader

rtsp.addResponseHeader( name, value )

Adds an RTSP header to the RTSP response that will be sent back to the client. If the header already exists in the response, via a case-insensitive lookup, this value will be appended to the existing value.

# Add a new transport header
$my_header = "RTP/AVP/TCP; interleaved=0-1";
rtsp.addResponseHeader( "Transport", $my_header );
See also: rtsp.setResponseHeader, rtsp.getResponseHeader, rtsp.removeResponseHeader, rtsp.addRequestHeader

rtsp.getMethod()

Returns the RTSP method that was used to make the request, such as SETUP or PLAY.

# Direct DESCRIBE requests to separate pool
if( rtsp.getMethod() == "DESCRIBE" ) {
   # set pool to Describe pool
}
See also: rtsp.setMethod

rtsp.getPath()

Returns the %-decoded path in the RTSP request URL

# Retrieve the requested file
$file = rtsp.getPath();
See also: rtsp.setPath, rtsp.getRawURL

rtsp.getRawURL()

Returns the raw URL data provided by the client in the first line of the RTSP request, after the method and before the RTSP version specifier. No %-decoding is performed on the URL.

$rawurl = rtsp.getRawURL();
if( string.contains( $rawurl, "../" ) ) {
   # Something suspicious here ...
   connection.discard();
}
See also: rtsp.getPath

rtsp.getRequest()

Returns the full RTSP request and headers, but does not include any body data.

# Get the complete rtsp request
$request = rtsp.getRequest();
See also: rtsp.listRequestHeaderNames, rtsp.getRequestHeader, rtsp.getRequestBody

rtsp.getRequestBody( [count] )

Returns the body data of the request.
If the optional 'count' parameter is supplied, rtsp.getRequestBody() will only read and return this number of bytes. If count is 0, rtsp.getRequestBody() returns the entire request.
If the request has no body, then this returns an empty string. This function is not useable in response rules, as the body data of the request will no longer be accessible.

# Read the entire request body
$body = rtsp.getRequestBody();
See also: rtsp.getResponseBody, rtsp.setRequestBody, rtsp.getRequestBodyLines

rtsp.getRequestBodyLines( count )

Splits the body data of the RTSP request into individual lines and returns an array of the data.
If the request has no body, then this returns an empty array.

# Read the entire request body
$body = rtsp.getRequestBodyLines();

# Process it line-by-line
foreach( $line in $body ) {
   # ...
}
See also: rtsp.getRequestBody, rtsp.getResponseBodyLines, rtsp.setRequestBody

rtsp.getRequestHeader( name )

Returns the value of a named RTSP header in the RTSP request, or the empty string if the header does not exist. The header name lookup is case-insensitive.

# Get the transport detail
$transport = rtsp.getRequestHeader( "Transport" );
See also: rtsp.setRequestHeader, rtsp.addRequestHeader, rtsp.removeRequestHeader, rtsp.getRequestHeaders

rtsp.getRequestHeaderNames() (deprecated)

Returns a list of all the headers that are present in the request.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; rtsp.listRequestHeaderNames should be used instead.

rtsp.getRequestHeaders()

Returns a hash containing all the header names in the request mapped to their values.

# Show all the headers in the request
$headers = rtsp.getRequestHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: rtsp.getRequestHeader, rtsp.setRequestHeader, rtsp.addRequestHeader, rtsp.removeRequestHeader, rtsp.requestHeaderExists, rtsp.getResponseHeaders

rtsp.getResponse()

Returns the full RTSP response and headers, but does not include any body data.

# Get the complete rtsp response
$request = rtsp.getResponse();
See also: rtsp.listResponseHeaderNames, rtsp.getResponseHeader, rtsp.getResponseBody

rtsp.getResponseBody( [count] )

Returns the body of the RTSP response. This could be an SDP response.
If the optional 'count' parameter is provided, rtsp.getResponseBody() will read and return the first 'count' bytes of the response. If count is 0, rtsp.getResponseBody() will return the entire response.

# Read the entire response body
$body = rtsp.getResponseBody();
See also: rtsp.getRequestBody, rtsp.setResponseBody, rtsp.getResponseBodyLines

rtsp.getResponseBodyLines( count )

Splits the body data of the RTSP request into individual lines and returns an array of the data.
If the request has no body, then this returns an empty array.

# Read the entire request body
$body = rtsp.getResponseBodyLines();

# Process it line-by-line
foreach( $line in $body ) {
   # ...
}
See also: rtsp.getResponseBody, rtsp.getRequestBodyLines, rtsp.setResponseBody

rtsp.getResponseCode()

Returns the status code from the first line of the RTSP response.

# Is the status '200'
if( rtsp.getResponseCode() == 200 ) {
   # ...
}
See also: rtsp.setResponseCode

rtsp.getResponseHeader( name )

Returns the value of a RTSP header in the RTSP response, or the empty string if the header does not exist. The header name lookup is case-insensitive.

# Get the transport header
$transport = rtsp.getResponseHeader( "Transport" );
See also: rtsp.setResponseHeader, rtsp.addResponseHeader, rtsp.removeResponseHeader, rtsp.responseHeaderExists, rtsp.getRequestHeader, rtsp.getResponseHeaders

rtsp.getResponseHeaderNames() (deprecated)

Returns a list of all the headers that are present in the response.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; rtsp.listResponseHeaderNames should be used instead.

rtsp.getResponseHeaders()

Returns a hash containing all the header names in the response mapped to their values.

# Show all the headers in the response
$headers = rtsp.getResponseHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: rtsp.getResponseHeader, rtsp.setResponseHeader, rtsp.addResponseHeader, rtsp.removeResponseHeader, rtsp.responseHeaderExists, rtsp.getRequestHeaders

rtsp.getVersion()

Returns the version of the RTSP protocol being used. It returns the version string in the RTSP/version specifier in the first line of the RTSP request, such as 'RTSP/1.0'.

# Get the RTSP version
$version = rtsp.getVersion();

rtsp.listRequestHeaderNames()

Returns a list of all the headers that are present in the request.
The headers are returned as a an array.

# Log all of the header names and values
$headers = rtsp.listRequestHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" .
            rtsp.getRequestHeader($header));
}
See also: rtsp.listResponseHeaderNames, rtsp.getRequestHeader, rtsp.getRequestHeaders

rtsp.listResponseHeaderNames()

Returns a list of all the headers that are present in the response.
The headers are returned as an array.

# Log all of the header names and values
$headers = rtsp.listResponseHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" .
            rtsp.getRequestHeader($header));
}
See also: rtsp.getResponseHeader, rtsp.removeResponseHeader, rtsp.getResponseHeaders, rtsp.listRequestHeaderNames

rtsp.redirect( path )

Sends back an RTSP 302 redirect response, which will send the client to a different URL. This is equivalent to rtsp.sendResponse( "302 Moved Temporarily", "", "Location: " . $url );

# Redirect requests for a particular file elsewhere
$path = rtsp.getPath();
if( $path == "specialfile" ) {
   rtsp.redirect( "rtsp://otherserver/" . $path );
}
See also: rtsp.sendResponse

rtsp.removeRequestHeader( name )

Removes an RTSP header if it exists in the request. The header name lookup is case-insensitive.

# Remove the transport header
rtsp.removeRequestHeader( "Transport" );
See also: rtsp.setRequestHeader, rtsp.getRequestHeader, rtsp.addRequestHeader

rtsp.removeResponseHeader( name )

Removes a RTSP header from the RTSP response. The header name is automatically translated to the correct case.

# Remove the GET_PARAMETER header
rtsp.removeResponseHeader( "GET_PARAMETER" );
See also: rtsp.setResponseHeader, rtsp.getResponseHeader, rtsp.addResponseHeader, rtsp.removeRequestHeader

rtsp.requestHeaderExists( names )

Reports if a header exists or not. It is similar to rtsp.getRequestHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
The header name lookup is case-insensitive.
It returns 1 if the header exists, and 0 if it does not.

# Check for the Transport header
if( rtsp.requestHeaderExists( "Transport" ) ) {
   # Modify the transport options
}

rtsp.responseHeaderExists( name )

Reports if a named header exists in the RTSP response. It is similar to rtsp.getResponseHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
The header name lookup is case-insensitive.
It returns 1 if the header exists, and 0 if it does not.

# Test for the 'Transport' response header
if( rtsp.responseHeaderExists( "Transport" ) ) {
   # modify the parameters
}
See also: rtsp.getResponseHeader

rtsp.sendResponse( code, body, headers )

Sends back an RTSP response to the client instead of balancing the request via a pool onto a node. It generates a correct RTSP response from the response code, body data and headers supplied. Multiple headers should be separated with \r\n.

# Discard SET_PARAMETER requests if the server
# does not support it
if( rtsp.getMethod() == "SET_PARAMETER" ) {
   rtsp.sendResponse( "401 Unauthorised", "", "" );
}

rtsp.setMethod( method )

Sets the RTSP method to use when forwarding the request via a pool to a node.

# Force the client to send an OPTIONS packet
rtsp.setMethod( "OPTIONS" );
See also: rtsp.getMethod

rtsp.setPath( url )

Replaces the Path portion of the request URL with the supplied value.

# Make customer view specific file:
rtsp.setPath( "myvideo.rm" );
See also: rtsp.getPath

rtsp.setRequestBody( body )

Sets the request body for this RTSP request, replacing any request body already present.
This also updates the 'Content-Length' header in the request to the length of the new body data.

$body = rtsp.getRequestBody( 0 );
$body = string.regexsub( $body, "Buy", "Sell", "g" );
rtsp.setRequestBody( $body );
See also: rtsp.getRequestBody, rtsp.setResponseBody

rtsp.setRequestHeader( name, value )

Sets the value of a RTSP header, replacing any existing value if the header already exists.
Note that this function should not be used with the Connection header, i.e. setRequestHeader("Connection", value) since it may not give the expected results.
The header name lookup is case-insensitive.

# Replace the transport header
$my_header = "RTP/AVP/TCP; interleaved=0-1";
rtsp.setRequestHeader( "Transport", $my_header );
See also: rtsp.getRequestHeader, rtsp.addRequestHeader, rtsp.removeRequestHeader

rtsp.setResponseBody( body )

Sets the response body for this RTSP response, replacing any response body already present.
This also updates the 'Content-Length' header in the response to the length of the new body data. If the server is still sending the original response body when this function is called, the connection to the server will be harmlessly dropped.

$body = rtsp.getResponseBody( 0 );
$body = string.regexsub( $body, "Buy", "Sell", "g" );
rtsp.setResponseBody( $body );
See also: rtsp.getResponseBody, rtsp.setRequestBody

rtsp.setResponseCode( code, [message] )

Sets the status code and message in the first line of the RTSP response.

# Stop clients receiving a particular file
$path = rtsp.getPath();
if( $path == "specialfile" ) {
   rtsp.setResponseCode( "401", "Unauthorised" );
}
See also: rtsp.getResponseCode

rtsp.setResponseHeader( name, value )

Sets a RTSP header in the RTSP response that will be sent back to the client. If the header already exists in the response, via a case-insensitive lookup, it will be replaced with this new value.
Note that this function should not be used with the Connection header, i.e. setResponseHeader("Connection", value) since it may not give the expected results.

# Replace the transport header
$my_header = "RTP/AVP/TCP; interleaved=0-1";
rtsp.setResponseHeader( "Transport", $my_header );
See also: rtsp.addResponseHeader, rtsp.getResponseHeader, rtsp.removeResponseHeader, rtsp.setRequestHeader

rule.getName()

Returns the name of the currently executing rule.

$rulename = rule.getname();

rule.getState()

Returns the state of the currently executing rule, either "REQUEST", "RESPONSE", "COMPLETION" or "GLBRESPONSE".

$rulestate = rule.getstate();

sip.addRequestHeader( name, value, at_top )

Modifies the current SIP request, adding a SIP header with the supplied value. If the header already exists, then this value will be appended to the existing value. If at_top is set then the value will be prepended to the header. The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Add a priority header if it is missing
if( !sip.requestHeaderExists( "Priority" ) ) {
   sip.addRequestHeader( "Priority", "normal", 0 );
}
See also: sip.setRequestHeader, sip.getRequestHeader, sip.removeRequestHeader, sip.requestHeaderExists

sip.addResponseHeader( name, value, at_top )

Adds a header to the SIP response that will be sent back to the client. If the header already exists in the response, via a case-insensitive lookup, then this value will be appended to the existing value. If at_top is set then the value will be prepended to the existing value.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Use an internal webpage to see if the callee is
# logged into their system
$loggedin = http.request.get(
                  "http://internal.example.com/".
                  "lookupuser=bob" );
if( $loggedin = "No" ) {
   # Set a warning if they are not
   sip.addResponseHeader( "Warning",
      "399 riverbed.com User is not logged in. ".
      " Your call might not be answered.", 0 );
}
See also: sip.setResponseHeader, sip.getResponseHeader, sip.removeResponseHeader, sip.addRequestHeader

sip.getMethod()

Returns the SIP method that was used to make the request, such as INVITE or REGISTER.

# Direct REGISTER requests to Registrar
if( sip.getMethod() == "REGISTER" ) {
   # set pool to Registrar pool
}
See also: sip.setMethod

sip.getRequest()

Returns the full SIP request and headers, but does not include any body data.

# Get the full SIP headers
$request = sip.getRequest();
See also: sip.listRequestHeaderNames, sip.getRequestHeader

sip.getRequestBody()

Returns the data contained in the body of the request.

# Get the inbound Session Description to check for
# unsupported content
if( sip.getMethod() == "INVITE" ) {
   $body = sip.getRequestBody();
   # inspect packet body
}
See also: sip.setRequestBody, sip.getResponseBody, sip.getRequestBodyLines

sip.getRequestBodyLines()

Splits the body data of the SIP request into individual lines and returns an array of the data.
If the request has no body, then this returns an empty array.

# Read the request body
$body = sip.getRequestBodyLines();

# See if it's an SDP
if( string.startswith( $body[0], "v=0" ) ) {
   # Process SDP data
}
See also: sip.getRequestBody, sip.getResponseBodyLines, sip.setRequestBody

sip.getRequestHeader( name )

Returns the named SIP header in the SIP request, or the empty string if the header does not exist. The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Get information about the UAC
# originating this request
$uac = sip.getRequestHeader( "User-Agent" );

# this returns the same value
$uac = sip.getRequestHeader( "user-agent" );
See also: sip.setRequestHeader, sip.addRequestHeader, sip.removeRequestHeader, sip.requestHeaderExists, sip.getRequestHeaders

sip.getRequestHeaderNames() (deprecated)

Returns a list of all the headers that are present in the request.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; sip.listRequestHeaderNames should be used instead.

sip.getRequestHeaders()

Returns a hash containing all the header names in the request mapped to their values.

# Show all the headers in the request
$headers = sip.getRequestHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: sip.getRequestHeader, sip.setRequestHeader, sip.addRequestHeader, sip.removeRequestHeader, sip.requestHeaderExists, sip.getResponseHeaders

sip.getRequestURI()

Returns the target of the SIP request.

# Check a status file to see if this user
# wants to accept calls.
if( sip.getRequestURI() == "sip:bob@example.com" ) {
   # see if this user is available
   $status = http.request.get(
      "http://www.example.com/status.cgi?user=bob" );
   if( $status != "available" ) {
      sip.sendResponse( "486",
                    "User is currently " . $status );
   }
}
See also: sip.setRequestURI

sip.getResponse()

Returns the full SIP response and headers, but does not include any body data.

# Get the full SIP headers
$request = sip.getResponse();
See also: sip.listResponseHeaderNames, sip.getResponseHeader

sip.getResponseBody()

Returns the session description of the SIP response.

# Read the entire response body
$sdp = sip.getResponseBody();
See also: sip.setResponseBody, sip.getRequestBody, sip.getResponseBodyLines

sip.getResponseBodyLines()

Splits the body data of the SIP response into individual lines and returns an array of the data.
If the response has no body, then this returns an empty array.

# Get the response body
$sdp = sip.getResponseBodyLines();

# Process it line-by-line
foreach( $line in $sdp ) {
   # ...
}
See also: sip.getResponseBody, sip.setResponseBody, sip.getRequestBodyLines

sip.getResponseCode()

Returns the status code from the first line of the SIP response.

# Is the status '200'
if( sip.getResponseCode() == 200 ) {
   # ...
}
See also: sip.setResponseCode

sip.getResponseHeader( name )

Returns the value of a header in the SIP response, or the empty string if the header does not exist. The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Get the route all future requests will take
$rr = sip.getResponseHeader( "Record-Route" );
See also: sip.setResponseHeader, sip.addResponseHeader, sip.removeResponseHeader, sip.responseHeaderExists, sip.getRequestHeader, sip.getResponseHeaders

sip.getResponseHeaderNames() (deprecated)

Returns a list of all the headers that are present in the response.
The headers are returned as a single string, separated by spaces.

This function has been deprecated; sip.listResponseHeaderNames should be used instead.

sip.getResponseHeaders()

Returns a hash containing all the header names in the response mapped to their values.

# Show all the headers in the response
$headers = sip.getResponseHeaders();

foreach( $header in hash.keys( $headers ) ) {
   log.info( $header . "=" . $headers[$header] );
}
See also: sip.getResponseHeader, sip.setResponseHeader, sip.addResponseHeader, sip.removeResponseHeader, sip.responseHeaderExists, sip.getRequestHeaders

sip.getVersion()

Returns the version of the SIP protocol being used. It returns the version string in the SIP/version specifier in the first line of the SIP request, such as 'SIP/2.0'.

# Get the SIP version
$version = sip.getVersion();

sip.listRequestHeaderNames()

Returns a list of all the headers that are present in the request.
The headers are returned as an array.

# Log all of the header names and values
$headers = sip.listRequestHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" .
            sip.getRequestHeader($header));
}
See also: sip.getRequestHeader, sip.removeRequestHeader, sip.getRequest, sip.listResponseHeaderNames, sip.getRequestHeaders

sip.listResponseHeaderNames()

Returns a list of all the headers that are present in the response.
The headers are returned as an array.

# Log all of the header names and values
$headers = sip.listResponseHeaderNames();
foreach( $header in $headers ) {
   log.info($header . "=" .
            sip.getResponseHeader($header));
}
See also: sip.getResponseHeader, sip.removeResponseHeader, sip.listRequestHeaderNames, sip.getResponseHeaders

sip.redirect( contact )

Sends back a 302 Moved Temporarily response. This response instructs the client to retry the request at the new address(es) given in the 'contact' parameter. This is equivalent to sip.sendResponse( "302", "Moved Temporarily", "Contact: " . $uri, "" );

# Example's offices are closed, redirect all their
# calls to voicemail.
$user = sip.getRequestURI();
if( string.EndsWith( $user, "@example.com" ) ) {
   $username = string.left( $user,
                      string.find( $user, "@" ) );
   $contact = $username . "@voicemail.example.com";
   sip.redirect( $contact );
}
See also: sip.sendResponse

sip.removeRequestHeader( name )

Removes a header if it exists in the request. The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Filter out any custom alert tones that have
# been specified by the client
sip.removeRequestHeader( "Alert-Info" );
See also: sip.getRequestHeader, sip.addRequestHeader, sip.setRequestHeader

sip.removeResponseHeader( name )

Removes a header from the SIP response.
The header name lookup is case-insensitive. You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Remove the server header, if it exists, to avoid
# application-specific exploits being used
sip.removeResponseHeader( "Server" );
See also: sip.setResponseHeader, sip.getResponseHeader, sip.addResponseHeader, sip.removeRequestHeader

sip.requestHeaderExists( name )

Reports if a named header exists or not. It is similar to sip.getRequestHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.
It returns 1 if the header exists, and 0 if it does not.

# Add a Priority header if it is missing
if( !sip.requestHeaderExists( "Priority" ) ) {
   sip.addRequestHeader( "Priority", "normal", 0 );
}
See also: sip.getRequestHeader

sip.responseHeaderExists( name )

Reports if a named header exists in the SIP response. It is similar to sip.getResponseHeader(), but makes it possible to distinguish between a header not being present and a header having no value.
The header name lookup is case-insensitive.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.
It returns 1 if the header exists, and 0 if it does not.

# Test for the 'Warning' response header
if( sip.responseHeaderExists( "Warning" ) ) {
   # ...
}
See also: sip.getResponseHeader

sip.sendResponse( code, reason, [headers], [body] )

Sends back a SIP response to the client instead of balancing the request via a pool onto a node. The Statue-Line of the response has the form: SIP/2.0 code reason Via, Record-Route, From, To, CSeq, Call-ID and Content-Length headers are automatically added to the response. Any headers supplied in the headers parameter will also be added to the response. Multiple headers must be separated by \r\n. Any body data specified is appended to the response.

# Send Forbidden response if the user is blacklisted
$contact = sip.getRequestHeader( "Contact" );
if( string.contains( $contact, "10.234.12.42" ) ) {
   sip.sendResponse( "403", "Forbidden" );
}
See also: sip.redirect

sip.setMethod( method )

Sets the SIP method to use when forwarding the request via a pool to a node.

# Force non-standard PING requests to become OPTIONS
if( sip.getMethod() == "PING" ) {
   sip.setMethod( "OPTIONS" );
   sip.setRequestHeader( "Max-Forwards", "1" );
}
See also: sip.getMethod

sip.setRequestBody( body )

Sets the request body for this SIP request to the supplied string, replacing any request body already present.
This also updates the 'Content-Length' header in the request to the length of the new body data.

$body = sip.getRequestBody();
# Forward all data from the server through an
# intermediate machine
$body = string.regexsub($body, request.getRemoteIP(),
                        "192.168.9.100", "g");
sip.setRequestBody( $body );
See also: sip.getRequestBody

sip.setRequestHeader( name, value )

Sets a SIP header, replacing any existing value if the header already exists.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Add a reference to an information page about
# a known company when a call is received from
# them, and an icon to help identify them.
if( sip.getRequestHeader( "Organization" )
                                 == "Riverbed" ) {
   sip.setRequestHeader( "Call-Info",
      "<http://www.riverbed.com/" .
      "assets/img/logo.gif> ;purpose=icon,".
      "<http://www.riverbed.com/" .
      "about/> ;purpose=info"
   );
}
See also: sip.addRequestHeader, sip.getRequestHeader, sip.requestHeaderExists, sip.removeRequestHeader

sip.setRequestURI( uri )

Sets the target of the SIP request.

# If the user has recently changed username, rewrite
# requests that address their old username.
if( sip.getRequestURI() == "sip:jond@example.com" ) {
   sip.setRequestURI( "sip:jdoe@example.com" );
}
See also: sip.getRequestURI

sip.setResponseBody( body )

Sets the response body for this SIP response, replacing any response body already present.
This also updates the 'Content-Length' header in the response to the length of the new body data. If the server is still sending the original response body when this function is called, the connection to the server will be harmlessly dropped.

$body = sip.getResponseBody();
# Forward all data from the client through an
# intermediate machine
$body = string.regexsub( $body,
                         "c=.*",
                         "c=IN IP4 "
                        ."192.168.9.100",
                         "g");
sip.setResponseBody( $body );
See also: sip.getResponseBody, sip.setRequestBody

sip.setResponseCode( code, [message] )

Sets the status code and message in the first line of the SIP response.

# Redirect client to a backup server if the proxy
# has an internal error.
if( sip.getResponseCode() == "500" ) {
   sip.setResponseHeader( "Contact",
               "sip:backup.example.com" );
   sip.setResponseCode( "305", "Use Proxy" );
}
See also: sip.getResponseCode

sip.setResponseHeader( name, value )

Sets a header in the SIP response that will be sent back to the client. If the header already exists in the response, via a case-insensitive lookup, then it will be replaced with this new value.
You can specify the long or short form of the header name, so 'Via' and 'v' will both match the Via header field.

# Change the server string
sip.setResponseHeader( "Server",
        "Stingray 5.0 (Linux/i386)" );
See also: sip.addResponseHeader, sip.getResponseHeader, sip.removeResponseHeader, sip.setRequestHeader

slm.conforming( [ class name ] )

Returns the current percentage of requests that are meeting the Service Level Monitoring objectives. If no class name is provided, it will use the SLM class currently associated with this connection; if no SLM class is associated with this connection, it returns 100.

# If the Gold customers are starting to get slow,
# gradually reroute other services...
$conforming = slm.conforming( "gold requests" );
if( ( $level == "bronze" && $conforming < 70 ) ||
    ( $level == "silver" && $conforming < 50 )) {
  # tell lower value customers to come back later to
  # reduce load on back-end node to ensure premium
  # customers get good response
  http.sendResponse( "302", "text/html", "",
     "Location: /toobusy.html" );
}
if( $conforming < 80 && $level != "gold" ) {
  # slow down rate of responding to non-premium
  # customers
  connection.sleep( 500 );
}
See also: slm.threshold, slm.isOK

slm.isOK( [ class_name ] )

Returns whether a particular Service Level Monitoring class is meeting its objectives. If no class name is provided, it will use the SLM class currently associated with this connection; if no SLM class is associated with the connection, it returns 1. This function is a convenience shorthand for 'slm.conforming() > slm.threshold()'.

# If the search nodes are under-utilised, use this
# spare capacity to process web page requests too
if( slm.isOK( "search-nodes" )) {
  pool.use( "search+web nodes");
} else {
  pool.use( "web nodes" );
}
See also: slm.conforming, slm.threshold

slm.threshold( [ class_name ] )

returns the value of the serious_threshold setting in the given SLM class. If no class name is provided, it will use the SLM class currently associated with this connection; if no SLM class is associated with the connection, it returns 0.

# If we are within 10% of our threshold, divert a
# portion of traffic elsewhere. If we are less than
# 25% below of our threshold, take evasive action to
# get our site's end user experience under control!

if( slm.conforming() < slm.threshold()*0.75 ) {
   # evasive action!
   log.warn(
     "Site performance requires evasive action" );
   if( $level == "bronze" ) {
      # send away low priority traffic
      http.sendResponse( "302", "text/html", "",
        "Location: /toobusy.html" );
   } else if( $level == "silver" ) {
      # slow down processing of medium traffic
      connection.sleep( 500 );
   } else if( $level == "gold" ) {
      # use reserved bandwidth QoS
      response.setBandwidthClass(
        "premium reserved bandwidth" );
  }
} else if( slm.conforming() < slm.threshold()*1.1 ) {
   # getting slow to the danger level; start
   # proactive traffic management
   if( $customer != "gold" ) {
     pool.use( "non-priority-nodes" );
  }
}
See also: slm.conforming, slm.isOK

ssl.clientCert()

Returns the PEM encoded client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate data
$cert = ssl.clientCert();
log.info( "Certificate: " . $cert );
See also: ssl.isSSL

ssl.clientCertAlgorithm()

If the connection is SSL-encrypted and the client has supplied a valid certificate, then this returns either 'rsaEncryption', 'md2withRSAEncryption', 'md5withRSAEncryption', 'sha1withRSAEncryption' or 'RSA', depending on the certificate's encryption and hash algorithms. Otherwise, it returns the empty string.

# Display the client certificate algorithm
$alg = ssl.clientCertAlgorithm();
log.info( "Certificate alg: ".$alg );
See also: ssl.isSSL

ssl.clientCertChain()

Returns the PEM encoded client certificate chain, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate data
$cert = ssl.clientCertChain();
log.info( "Certificate Chain: " . $cert );
See also: ssl.isSSL, ssl.clientCert

ssl.clientCertCommonName()

Returns the common name of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

$common_name = ssl.clientCertCommonName();
log.info( "Certificate common name: ".$common_name );
See also: ssl.isSSL

ssl.clientCertEndDate()

If the connection is SSL-encrypted and the client has supplied a valid certificate, then this returns the date when the certificate is no longer valid. The date is an integer, representing seconds since the epoch.
Otherwise, this function returns 0.

# Display the client certificate end date
$end = ssl.clientCertEndDate();
log.info( "Certificate is valid until ".
   sys.timeToString( $end ) );
See also: ssl.isSSL, ssl.clientCertStartDate, sys.timeToString

ssl.clientCertHash()

Returns a hex-encoded MD5 hash of the client certificate, or the empty string if the connection was not SSL-encrypted, if a certificate was not supplied or if the MD5 algorithm is unavailable (e.g. when operating in FIPS Mode).

# Display the client certificate hash
$hash = ssl.clientCertHash();
log.info( "Certificate hash: ".$hash );
See also: ssl.isSSL, ssl.clientCertSHA1, sys.isFIPS

ssl.clientCertIssuer()

Returns a string representing the issuer of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate issuer
$issuer = ssl.clientCertIssuer();
log.info( "Certificate issuer: ".$issuer );
See also: ssl.isSSL

ssl.clientCertPublicKey()

Returns a string representation of the public key of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate key
$key = ssl.clientCertPublicKey();
log.info( "Certificate key: ".$key );
See also: ssl.isSSL

ssl.clientCertSHA1()

Returns a hex-encoded SHA1 fingerprint of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate SHA1 fingerprint
$sha1 = ssl.clientCertSHA1();
log.info( "Certificate SHA1 fingerprint: " . $sha1 );
See also: ssl.isSSL, ssl.clientCertHash

ssl.clientCertSerial()

Returns the serial (in hex) of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate serial
$serial = ssl.clientCertSerial();
log.info( "Certificate serial: ".$serial );
See also: ssl.clientCertSerialDec

ssl.clientCertSerialDec()

Returns the serial (in decimal) of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate serial in decimal
$serial = ssl.clientCertSerialDec();
log.info( "Certificate serial: ".$serial );
See also: ssl.clientCertSerial

ssl.clientCertStartDate()

If the connection is SSL-encrypted and the client has supplied a valid certificate, then this returns the date when the certificate became valid. The date is an integer, representing seconds since the epoch.
Otherwise, this function returns 0.

# Display the client certificate start date
$start = ssl.clientCertStartDate();
log.info( "Certificate is valid from ".
   sys.timeToString( $start ) );
See also: ssl.isSSL, ssl.clientCertEndDate, sys.timeToString

ssl.clientCertStatus()

Returns 'OK' if the client certificate is valid, or 'NoClientCert' if it was missing or not valid. It returns the empty string if the connection was not SSL-encrypted.

if( ssl.clientCertStatus() != "OK" ) {
   # Handle missing client certificate ...
}
See also: ssl.isSSL

ssl.clientCertSubject()

Returns a string representing the subject of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate subject
$subject = ssl.clientCertSubject();
log.info( "Certificate subject: ".$subject );
See also: ssl.isSSL

ssl.clientCertVersion()

Returns "1", "2" or "3" denoting the version of the client certificate, or the empty string if the connection was not SSL-encrypted or if a certificate was not supplied.

# Display the client certificate version
$version = ssl.clientCertVersion();
log.info( "Certificate version: ".$version );
See also: ssl.isSSL

ssl.clientCipher()

Returns the cipher used by the client to SSL-encrypt the connection. It returns an empty string if the connection was not SSL-encrypted.
The string returned contains the cipher algorithm, SSL version and effective cipher strength, such as:

  SSL_RSA_WITH_RC4_128_SHA, version=SSLv3, bits=128

# Get the encryption cipher
$cipher = ssl.clientCipher();
log.info( "Encrypted with ".$cipher );
See also: ssl.isSSL

ssl.clientSupportsSecureRenegotiation()

Returns true if the client is RFC 5746 compliant, else false.

if( ssl.isSSL() ) {
   # gather statistics about client-side support
   # for RFC 5746
   if( ssl.clientSupportsSecureRenegotiation() ) {
      counter.increment( 1 );
   } else {
      counter.increment( 2 );
   }
}
See also: ssl.requireCert, ssl.requestCert, ssl.isSSL

ssl.getClientCloseAlert()

Check whether your traffic manager will send the SSL client an SSL close alert prior to terminating the TCP connection. The function will return a value of 1 if close alerts are enabled, and 0 if they are disabled. The function will return -1 if the client-side connection is not established, or is not an SSL connection.

if( ssl.isSSL() ) {
   $alert = ssl.getClientCloseAlert();
   log.info( "client close alert: " . $alert );
}
See also: ssl.isSSL, ssl.setClientCloseAlert, ssl.setServerCloseAlert, ssl.getServerCloseAlert

ssl.getServerCloseAlert()

Check whether your traffic manager will send the SSL server an SSL close alert prior to terminating the TCP connection. The function will return a value of 1 if close alerts are enabled, and 0 if they are disabled. The function will return -1 if the connection is not an SSL connection, or if the server-side connection is not yet established (i.e. it should typically only be used in response rules.)

if( ssl.isSSL() ) {
   $alert = ssl.getServerCloseAlert();
   log.info( "server close alert: " . $alert );
}
See also: ssl.isSSL, ssl.setServerCloseAlert, ssl.setClientCloseAlert, ssl.getClientCloseAlert

ssl.getTLSServerName()

Returns the hostname provided by the client using the TLS 1.0 'server_name' extension. If this connection is not using SSL decryption or the client did use the extension then this function returns the empty string.

$name = ssl.getTLSServerName();
log.info( "The client provided " .
          "the server name: " . $name );
See also: ssl.isSSL, ssl.setTLSServerName

ssl.isSSL()

Returns 1 if this connection from the remote client was SSL encrypted and your traffic manager has decrypted the traffic. Otherwise, it returns 0.

if( ssl.isSSL() ) {
   # This is an SSL-encrypted connection ...
}

ssl.requestCert()

Initiates an SSL renegotiation with the client, requesting a certificate. Even if the client fails to provide a certificate, rule processing continues after the re-handshake is complete. If the client had already provided a certificate, this function does nothing and rule processing continues. If the underlying connection is not SSL, the transaction is aborted (i.e., this is interpreted as a failed re-handshake). Note that using this function overrides the setting ssl!ssl3_allow_rehandshake. It is strongly recommended to check for client-side support of RFC 5746 before using it, see ssl.clientSupportsSecureRenegotiation.

$path = http.getPath();
if( string.startsWith( $path, "/wikileaks" ) ) {
   # Only let certain people see this data ...
   if( ssl.clientSupportsSecureRenegotiation() ) {
      ssl.requestCert();
      if( ssl.clientCertStatus() != "OK" ) {
         http.sendResponse( 403, "text/plain",
            "Valid SSL credentials are required",
            "" );
      } else {
         # allow the original request to
         # continue, client provided an
         # acceptable certificate.
         break;
      }
   } else {
      http.sendResponse( 403, "text/plain",
         "Please upgrade your browser", "" );
   }
}
See also: ssl.clientSupportsSecureRenegotiation, ssl.requireCert

ssl.requireCert()

Initiates an SSL renegotiation with the client, requiring a certificate. If the client fails to provide a valid cert, the connection is closed with an SSL alert of type handshake_failure. Otherwise, rule processing continues after the re-handshake is complete. If the client had already provided a certificate, this function does nothing and rule processing continues. If the underlying connection is not SSL, the transaction is aborted (i.e., this is interpreted as a failed re-handshake). Note that using this function overrides the setting ssl!ssl3_allow_rehandshake. It is strongly recommended to check for client-side support of RFC 5746 before using it, see ssl.clientSupportsSecureRenegotiation.

$path = http.getPath();
if( string.startsWith( $path, "/wikileaks" ) ) {
   # Only let certain people see this data ...
   if( ssl.clientSupportsSecureRenegotiation() ) {
      ssl.requireCert();
   } else {
      http.sendResponse( 403, "text/plain",
         "Please upgrade your browser", "" );
   }
}
See also: ssl.clientSupportsSecureRenegotiation, ssl.requestCert

ssl.serverCert()

Returns a PEM encoded version of the entire certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption then this function will return the empty string.

$cert = ssl.serverCert();
log.info( "Server certificate: " . $cert );
See also: ssl.isSSL

ssl.serverCertAlgorithm()

Returns a description of the algorithms being used by the virtual server's current certificate. This will either be "rsaEncryption", "md2withRSAEncryption", "md5withRSAEncryption", "sha1withRSAEncryption" or "RSA". If this virtual server is not using SSL decryption (or the algorithm type is not recognised) then this function will return the empty string.

$alg = ssl.serverCertAlgorithm();
log.info( "Server cert algorithm: " . $alg );
See also: ssl.isSSL

ssl.serverCertCommonName()

Returns the common name of the certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption then this function will return the empty string.

$common_name = ssl.serverCertCommonName();
if( http.getHostHeader() != $common_name ) {
   log.warn( "Client browser may report certificate".
      " as invalid." );
}
See also: ssl.isSSL

ssl.serverCertEndDate()

Returns the date that the certificate being used by your traffic manager for this connection became valid. The date is an integer, representing the number of seconds since the epoch. If this virtual server is not using SSL decryption then this function will return the empty string.

$end = ssl.serverCertEndDate();
if( $time < sys.time() ) {
   log.warn( "Using out of date certificate!" );
}
See also: ssl.isSSL, ssl.serverCertStartDate, sys.time, sys.timeToString

ssl.serverCertHash()

Returns the hex-encoded MD5 hash of the certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption or if the MD5 algorithm is unavailable (e.g. when operating in FIPS Mode) then this function will return the empty string.

$md5 = ssl.serverCertHash();
log.info( "Server Cert Hash: " . $md5 );
See also: ssl.isSSL, ssl.serverCertSHA1, sys.isFIPS

ssl.serverCertIssuer()

Returns a string with the issuer data of the certificate being used by your traffic manager for this connection (each field is separated by commas). If this virtual server is not using SSL decryption then this function will return the empty string.

$issuer = ssl.serverCertIssuer();
if( ssl.serverCertSubject() == $issuer ) {
   log.info( "Certificate is self-signed" );
}
See also: ssl.isSSL, ssl.serverCertSubject

ssl.serverCertName()

Returns the name of the certificate being used by the virtual server for this connection. This is the name used to identify the certificate in the UI. If this virtual server is not using SSL decryption then this function will return the empty string.

$name = ssl.serverCertName();
log.info( "Using server cert: " . $name );
See also: ssl.isSSL

ssl.serverCertPublicKey()

Returns information about the public key of the certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption then this function will return the empty string.

# Returns public key information,
# e.g. "RSA (1024 bit)"
$public_key = ssl.serverCertPublicKey();
log.info( "Certificate public key: " . $public_key );
See also: ssl.isSSL

ssl.serverCertSHA1()

Returns the hex-encoded SHA1 fingerprint of the certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption then this function will return the empty string.

$sha1 = ssl.serverCertSHA1();
log.info( "Server Cert SHA1 Fingerprint: " . $sha1 );
See also: ssl.isSSL, ssl.serverCertHash

ssl.serverCertSerial()

Returns a string with the serial number (in hex) of the certificate being used by your traffic manager for this connection. If this virtual server is not using SSL decryption then this function will return the empty string.

$serial = ssl.serverCertSerial();
log.info( "Server certificate serial: " . $serial );
See also: ssl.isSSL

ssl.serverCertStartDate()

Returns the date the certificate being used by your traffic manager for this connection became valid. The date is an integer, representing the number of seconds since the epoch. If this virtual server is not using SSL decryption then this function will return the empty string.

$start = ssl.serverCertStartDate();
log.info( "Server Certificate is valid from ".
    sys.timeToString( $start ) );
See also: ssl.isSSL, ssl.serverCertEndDate, sys.time, sys.timeToString

ssl.serverCertSubject()

Returns the subject data of the certificate being used by your traffic manager for this connection (each field is separated by commas). If this virtual server is not using SSL decryption then this function will return the empty string.

# Returns the subject information of the cert,
# e.g. C=GB, L=Cambridge, O=Riverbed, CN=foo.com
$subject = ssl.serverCertSubject();
log.info( "Server cert subject: " . $subject );
See also: ssl.isSSL, ssl.serverCertIssuer

ssl.serverCertVersion()

Returns the version of the certificate being used by your traffic manager for this connection (either "1", "2" or "3"). If this virtual server is not using SSL decryption then this function will return the empty string.

$version = ssl.serverCertVersion();
log.info( "Server Cert Version: " . $version );
See also: ssl.isSSL

ssl.serverSiteName()

Returns the hostname or IP address that was used to select the current server certificate. If the default certificate was used, or the current connection is not encrypted, the empty string is returned.

$site_name = ssl.serverSiteName();
if( ssl.isSSL() && $site_name == "" ) {
   # The default certificate was used
}
See also: ssl.isSSL

ssl.setClientCloseAlert( alertflag )

Sets whether your traffic manager will send the SSL client an SSL close alert prior to terminating the TCP connection. An value of 0 will disable close alerts, a non-zero value will enable close alerts. This setting also applies to related connections, such as data transfer channels related to FTP command channels. If the connection with the client is not an SSL connection then calling this function will do nothing.

if( ssl.isSSL() ) {
   # Ensure close alerts are enabled.
   ssl.setClientCloseAlert( 1 );
}
See also: ssl.isSSL, ssl.getClientCloseAlert, ssl.setServerCloseAlert, ssl.getServerCloseAlert

ssl.setServerCloseAlert( alertflag )

Sets whether your traffic manager will send the SSL server an SSL close alert prior to terminating the TCP connection. A value of 0 will disable close alerts, a non-zero value will enable close alerts. This setting also applies to related connections, such as data transfer channels related to FTP command channels. Note that this function will only work on SSL connections and the server side connection must be established (i.e. it should typically only be used in response rules.)

if( ssl.isSSL() ) {
   # Ensure close alerts are enabled.
   ssl.setServerCloseAlert( 1 );
}
See also: ssl.isSSL, ssl.getServerCloseAlert, ssl.setClientCloseAlert, ssl.getClientCloseAlert

ssl.setTLSServerName( servername )

Instructs your traffic manager to use the specified hostname when using the TLS 1.0 server_name extension. This method only works if the back end pool has SSL encryption and the server_name option enabled. Using the empty string as this function's parameter will make your traffic manager use the hostname of the node that it is connecting to.

# Use the hostname foo in the TLS 1.0 server_name
# extension
ssl.setTLSServerName( "foo" );
See also: ssl.isSSL, ssl.getTLSServerName

ssl.sslSessionID()

Returns the session ID of the current SSL connection as a hex-encoded string. If the connection was not SSL-encrypted then an empty string is returned.
This function can also be used with SSL pass-through traffic. When used in a request rule the traffic manager will look for a session ID provided in the ClientHello. Clients provide session IDs only if they are trying to resume a previously used SSL session. If the client did not provide a session ID, this function will return an empty string.
When used in a response rule with SSL pass-through traffic, this function will return the session ID provided in the ServerHello. This might be the same as the session ID sent by the client If the client attempted to resume the session, but this is not guaranteed.

# Get the SSL session ID
$sessionid = ssl.sslSessionID();
log.info( "SessionID: " . $sessionid );
See also: ssl.isSSL

stats.getQueueTime()

Returns the amount of time, in milliseconds, that the client spent queueing to connect to the server due to backend connection limits.

# Keep a record of how many connections
# queue for longer than 1 second.
if( stats.getQueueTime() > 1000 ) {
   # Increment user counter 1
   counter.increment( 1 );
}

stats.getServerResponseTime()

Returns the amount of time, in milliseconds, between sending the first byte of the request to the server, and receiving a response.
In the case of HTTP, SIP and RTSP this is the time until the traffic manager has received a full set of headers from the server. For all other protocols, it is the time until the traffic manager has received the first byte of the response from the server.
If the server has not sent a response, this function will return 0.

# Emit an event when the server takes a
# particularly long time to respond to a
# request.
if( stats.getServerResponseTime() > 30000 ) {
   event.emit( "slowresponse", http.getRawURL() );
}

stats.getTransactionDuration()

Returns the amount of time, in milliseconds, for which the current transaction has been active, from the time the first byte was received from the client to the current time.
If used in a transaction completion rule, this will be the total duration of the transaction.

# Record this connection on the recent connections
# page if it took more than 5 seconds to complete
if( stats.getTransactionDuration() > 5000 ) {
   recentconns.include();
}

string.BERToInt( string )

Converts a BER compressed integer into an integer.

# $r = 200
$r = string.BERToInt( "\201\110" );
Alternate name: BERToInt
See also: string.intToBER, string.bytesToInt

string.Ireplace( string, search, replacement ) (deprecated)

Replaces the first occurrence of the search string in the supplied string with the replacement. It is case-insensitive and returns the string with the replacement.

This function has been deprecated; string.replaceI should be used instead.

string.IreplaceAll( string, search, replacement ) (deprecated)

Replaces all occurrences of the search string in the supplied string with the replacement. It is case-insensitive and returns the string with the replacements.

This function has been deprecated; string.replaceAllI should be used instead.

string.append( str1, str2, ... )

Returns the result of concatenating all of its inputs together as strings.

# Returns "The answer is 42"
$s = string.append( "The ", "answer ", "is " , 42 );
Alternate name: append

string.base64decode( string )

Decodes a base64-encoded string and returns the result.
Base64 encoding is used for MIME-encoded messages, and in the HTTP Basic Authorization header.

# Decodes a username and password from HTTP
# BASIC authentication
$h = http.getHeader( "Authorization" );
if( string.startsWith( $h, "Basic " ) ) {
   $enc = string.skip( $h, 6 );
   $userpasswd = string.base64decode( $enc );
   log.info( "User used: ".$userpasswd );
}
Alternate name: base64decode
See also: string.base64encode, string.hexdecode, string.unescape

string.base64encode( string )

Returns the base64-encoded version of the provided string. This converts each group of three characters into a 4-character string containing just [A-Za-z0-9+/], and '=' for padding.
Base64 encoding is used for MIME-encoded messages, and in the HTTP Basic Authorization header.

# Encodes a username and password for HTTP
# BASIC authentication
$enc = string.base64encode( "user:passwd" );
$h = "Basic ".$enc;
http.setHeader( "Authorization", $h );
Alternate name: base64encode
See also: string.base64decode, string.hexencode, string.escape

string.bytesToDotted( string )

Converts a network ordered byte string into an IP address.

# The first 4 bytes are the IP address
$ipstr = string.substring( $msg, 0, 3 );
log.info( "IP is ".string.bytesToDotted( $ipstr ) );
Alternate name: bytesToDotted
See also: string.dottedToBytes, string.bytesToInt

string.bytesToInt( string )

Converts a byte string in network order to an integer. The byte string should be either 1, 2 or 4 bytes long.

# $msg starts with a 2-bytes length
$lenstr = string.substring( $msg, 0, 1 );
$len = string.bytesToInt( $lenstr );
$msg = string.substring( $msg, 2, 2+$len-1 );
Alternate name: bytesToInt
See also: string.intToBytes, string.bytesToDotted, string.BERToInt

string.cmp( str1, str2 )

Compares its two parameters as strings in a case-sensitive manner. It returns a negative value if str1 is less than str2; zero if they are equal, and a positive value if str1 is greater than str2.

if( string.cmp( $a, "HTTP/1.0" ) == 0 ) {
   # $a is "HTTP/1.0"
}

if( string.cmp( $a, $b ) < 0 ) {
   # $a is less than $b
}
Alternate name: cmp
See also: string.icmp

string.contains( haystack, needle )

Searches for the provided string (the needle) in the given source (the haystack).
It returns 1 if the 'needle' was found, or 0 otherwise.

if( string.contains( $cookie, "chocolate" ) ) {
   # The cookie contains chocolate ...
}
Alternate name: contains
See also: string.containsI, string.find, string.findr, string.startsWith, string.endsWith

string.containsI( haystack, needle )

Searches for the provided string (the needle) in the given source (the haystack). It is case-insensitive.
It returns 1 if the 'needle' was found, or 0 otherwise.

if( string.containsI( $path, "danger" ) ) {
   # The path contains danger ...
}
Alternate name: containsI
See also: string.contains, string.findI, string.startsWithI, string.endsWithI

string.count( haystack, needle, [start] )

Searches from the start of a string, counting the number of times that the provided search string (the needle) is found inside the given string (the haystack). An optional parameter can specify the start position for the search.
It returns the number of times that the string is found.

# Returns 2
$r = string.count( "This is it!", "is" );

# Returns 1, no overlaps allowed
$s = string.count( "ooo", "oo" );
Alternate name: count
See also: string.find, string.contains

string.decrypt( string, passphrase )

Returns the decrypted version of a string that has previously been encrypted using string.encrypt(). The passphrase supplied must match that given to string.encrypt(), otherwise the decoding will fail.
An empty string is returned if the decrypt or the integrity check fails.

# Decrypt the 'kart' cookie
$cookie = http.getcookie( "kart" );
if( $cookie != "" ) {
   $cookie = string.decrypt( $cookie, $passphrase );
   if( $cookie == "" ) {
      log.warn( "User modified kart cookie" );
      http.removecookie( "kart" );
   } else {
      http.setcookie( "kart", $cookie );
   }
}
Alternate name: decrypt
See also: string.encrypt

string.dottedToBytes( IP address )

Converts an IP address to a network order byte string.

# Prepend the client IP onto $msg
$ip = request.getRemoteIP();
$msg = string.dottedToBytes( $ip ).$msg;
Alternate name: dottedToBytes
See also: string.bytesToDotted, string.intToBytes

string.drop( string, count )

Returns all but the last 'count' characters from the end of the provided string. An empty string will be returned if 'count' is greater than the length of the original string.

# returns "www.example"
$s = string.drop( "www.example.com", 4 );
Alternate name: drop
See also: string.skip, string.trim

string.encrypt( string, passphrase )

Encrypts a string using the provided pass phrase. The returned string is encrypted using the AES block cipher, using an expanded form of the passphrase as the cipher key. A MAC is also added to ensure the integrity of the string.
This is open to replay attacks, and as such, should not be used to encrypt sensitive data, such as credit card details.

# Encrypt the 'kart' cookie
$cookie = http.getresponsecookie( "kart" );
if( $cookie != "" ) {
   $cookie = string.encrypt( $cookie, $passphrase );
   http.setresponsecookie( "kart", $cookie );
}
Alternate name: encrypt
See also: string.decrypt

string.endsWith( string, suffix )

Returns 1 if the provided string ends with the given suffix, and 0 otherwise.

if( string.endsWith( $url, ".cgi") ) {
   # Request is for a CGI script ...
}
Alternate name: endsWith
See also: string.endsWithI, string.startsWith, string.contains

string.endsWithI( string, suffix )

Returns 1 if the provided string ends with the given suffix, and 0 otherwise. It is case-insensitive.

if( string.endsWithI( $path, "victory") ) {
   # The path ends with victory
}
Alternate name: endsWithI
See also: string.endsWith, string.startsWithI, string.containsI

string.escape( string )

Returns a percent-encoded version of its parameter.
Control characters and spaces (character value <= 32) and '%' characters are each replaced by a '%' symbol, followed by their 2-digit hex value.

# returns "Hello%20World!%0D%0A"
$s = string.escape( "Hello World!\r\n" );
Alternate name: escape
See also: string.unescape, string.hexencode, string.regexescape, string.urlencode

string.extractHost( string )

Returns the host part of the supplied address if it is a valid IP or hostname. Otherwise the empty string is returned.

sub lookup_proxy( $path ) {
   # Code to map a path to a node
}
# Send certain requests to an external server
$forward = lookup_proxy( http.getPath() );
if( $forward
    && $host = string.extractHost( $forward ) ) {
   if( !$port = string.extractPort( $forward ) ) {
      $port = 80;
   }
   pool.use( "External", $host, $port );
}
Alternate name: extractHost
See also: string.extractPort

string.extractPort( string )

Returns the port part of the supplied address if both the host and port of the supplied address are valid. Otherwise the empty string is returned.

# Get the SIP request's next destination
$next = sip.getRequestHeader( "Route" );
string.regexmatch( $next, "^" );
$next = $1;
# Get the port number of the destination
if( $port = string.extractPort( $next ) ) {
   if( $port < 1024 ) {
      # Don't forward the message
      sip.sendResponse( "403", "Forbidden" );
   }
}
Alternate name: extractPort
See also: string.extractHost

string.find( haystack, needle, [start] )

Reports whether the provided search string (the needle) is contained inside the given string (the haystack). An optional parameter can specify the start position for the search.
It returns the location of the first instance of the search string; note that character positions start at 0.
If it could not find the search string, it returns -1.

$r = string.find( "This is it!", "is" ); # Returns 2
Alternate name: find
See also: string.findI, string.findr, string.contains

string.findI( haystack, needle, [start] )

Reports whether the provided search string (the needle) is contained inside the given string (the haystack). An optional parameter can specify the start position for the search. It is case-insensitive.
It returns the location of the first instance of the search string; note that character positions start at 0.
If it could not find the search string, it returns -1.

# Returns 0
$r = string.findI( "The way of the warrior", "the" );
Alternate name: findI
See also: string.find, string.containsI

string.findr( haystack, needle, [distanceFromEndToStart] )

Searches backwards from the end of a string, determining whether the provided search string (the needle) is contained inside the given string (the haystack). An optional parameter can specify the start position for the search, measured from the end of the string (so setting it to 1 skips the last character in the string).
It returns the location of the last instance of the search string; note that character positions start at 0.
If it could not find the search string, it returns -1.

# Returns 8 (the 'i' in it)
$r = string.findr( "This is it!", "i" );

# Returns 5 (the 'i' in is)
$r = string.findr( "This is it!", "i", 3 );
Alternate name: findr
See also: string.find, string.contains

string.hash( string )

Returns a number representing a hash of the provided string. When using string.hash(), negative numbers can be returned for the hash value. The returned value should not be relied on to be consistent across different releases of the software.

$hash = string.hash( http.getRawURL() );
connection.setPersistenceKey( $hash % 1000 );
Alternate name: hash

string.hashMD5( string )

Returns the MD5 hash of the provided string. The returned string will be 16 bytes long, and may contain non-printable characters.

$hash = string.hashMD5( $data );
Alternate name: hashMD5
See also: string.hexencode, string.hashSHA1, string.hashSHA256, string.hashSHA384, string.hashSHA512

string.hashSHA1( string )

Returns the SHA1 hash of the provided string. The returned string will be 20 bytes long, and may contain non-printable characters.

$hash = string.hashSHA1( $data );
Alternate name: hashSHA1
See also: string.hexencode, string.hashMD5, string.hashSHA256, string.hashSHA384, string.hashSHA512

string.hashSHA256( string )

Returns the SHA-256 hash of the provided string. The returned string will be 32 bytes long, and may contain non-printable characters.

$hash = string.hashSHA256( $data );
Alternate name: hashSHA256
See also: string.hexencode, string.hashMD5, string.hashSHA1, string.hashSHA384, string.hashSHA512

string.hashSHA384( string )

Returns the SHA-384 hash of the provided string. The returned string will be 48 bytes long, and may contain non-printable characters.

$hash = string.hashSHA384( $data );
Alternate name: hashSHA384
See also: string.hexencode, string.hashMD5, string.hashSHA1, string.hashSHA256, string.hashSHA512

string.hashSHA512( string )

Returns the SHA-512 hash of the provided string. The returned string will be 64 bytes long, and may contain non-printable characters.

$hash = string.hashSHA512( $data );
Alternate name: hashSHA512
See also: string.hexencode, string.hashMD5, string.hashSHA1, string.hashSHA256, string.hashSHA384

string.hexToInt( string )

Converts a hexadecimal number to an integer. Returns the first valid hexadecimal value found in the string, or 0. A prefix of "0x" is accepted, but not required. Negative numbers are also valid.

# Returns 10.
$int = string.hexToInt( "0000a" );
See also: string.intToHex

string.hexdecode( encoded string )

Returns the hex-decoded version of the provided string. This interprets each character pair as a 2-digit hex value, replacing it with the corresponding 8-bit character. It does not verify that the original string was correctly encoded.

# returns "hello"
$s = string.hexdecode("68656C6C6F");
Alternate name: hexdecode
See also: string.hexencode, string.base64decode, string.unescape

string.hexencode( string )

Returns the hex-encoded version of the provided string . This converts each character into a two-character hex representation, doubling the length of the string.

# Returns "68656C6C6F"
$s = string.hexencode( "hello" );
Alternate name: hexencode
See also: string.hexdecode, string.base64encode, string.escape

string.htmldecode( encodedstring )

Returned the HTML-decoded version of a string, converting symbols such as &lt; and &quot;

$body = string.htmldecode( http.getBody( 0 ) );
Alternate name: htmldecode
See also: string.htmlencode

string.htmlencode( string )

Returns the encoded version of the supplied string to make it safe for including in HTML. It converts '<' to &lt;, '>' to &gt;, '"' to &quot; and '&' to &amp;. Control characters are hex-encoded.

$html = string.htmlencode( $parameter );
Alternate name: htmlencode
See also: string.htmldecode, string.urlencode

string.icmp( str1, str2 )

Compares its two parameters as strings in a case-insensitive manner. It returns a negative value if str1 is less than str2; zero if they are equal, and a positive value if str1 is greater than str2.

if( string.icmp( $a, "Content-Length" ) == 0 ) {
   # $a is "Content-Length"
}
Alternate name: icmp
See also: string.cmp

string.insertBytes( string, insertion, offset )

Inserts a string into another string at the supplied offset, and returns the resulting string. If offset < 0, or offset > length( string ), the original string is returned unchanged. If offset == 0 the insertion string is prepended; if offset == length( string ) the insertion string is appended.

# $r = "he was Othello"
$r = string.insertbytes( "hello", " was Othe", 2 );

# $r = "hello world"
$r = string.insertbytes( "hello", " world", 5 );

# $r = "I say hello"
$r = string.insertbytes( "hello", "I say ", 0 );
Alternate name: insertBytes
See also: string.replaceBytes

string.intToBER( number )

Converts an integer into a BER compressed integer (which is a variable-length binary string encoding).

# $r = "\201\110"
$r = string.intToBER( 200 );
Alternate name: intToBER
See also: string.BERToInt, string.intToBytes

string.intToBytes( number, [width] )

Converts an integer to a network order byte string of the specified width. Only widths of 1, 2 and 4 are permitted, and the width defaults to 4 if it is not supplied.

# Prepend $msg with its length, as a 4-byte int
string.insertBytes( $msg,
   string.intToBytes( string.len( $msg ) ),
   0 );
Alternate name: intToBytes
See also: string.bytesToInt, string.bytesToDotted, string.intToBER

string.intToHex( string )

Converts an integer into a hexadecimal string.

# Returns "0000cafe"
$hex = string.intToHex( 51966 );
See also: string.hexToInt

string.ipmaskmatch( IP Address, CIDR IP Subnet )

Returns 1 if the provided IP address is contained in the CIDR IP Subnet, and 0 otherwise.
It interprets its first parameter as a string containing an IP address, and its second parameter as an CIDR IP subnet. CIDR IP subnets can be of the form "10.0.1.0/24", "10.0.1.0/255.255.255.0", "10.0.1." or "10.0.1.1".
For IPv6, the standard notation of "2001:200:0:8002::/64" is supported.

if( string.ipmaskmatch( $ip, "10.0.0.0/8" ) ) {
   # IP is in the 10.*.*.* subnet ...
}
Alternate name: ipmaskmatch
See also: string.validIPAddress

string.left( string, count )

Returns the first 'count' characters of the provided string. An empty string will be returned if 'count' is less than or equal to zero.

# returns "#!"
$s = string.left( "#!/bin/sh", 2 );
Alternate name: left
See also: string.skip

string.len( string )

Interprets its parameter as a string and returns its length (in bytes).

$len = string.len( "Hello world!" ); # returns 12
Alternate name: len

string.length( string )

This function is an alias for string.len.

$len = string.length( "Hello world!" ); # returns 12
Alternate name: length
See also: string.len

string.lowercase( string )

Converts all characters in the provided string to lowercase and returns the result.

$s = string.lowercase("AbCdEfG"); # Returns "abcdefg"
Alternate name: lowercase
See also: string.uppercase

string.normalizeIPAddress( string )

Returns a unique string representation of an IP address: all leading zeros are removed, and for IPv6 addresses the first occurrence of blocks consisting entirely of zeros is replaced by "::". This normal form can be used to compare IP addresses without ambiguity and is also the form used by TrafficScript functions returning IP addresses. If the string is not a valid IP address, the empty string is returned.

$remote_ip = request.getremoteip();
$client = string.normalizeipaddress(
            "2001:0:0157::0:006a" );
# $client is now "2001::157:0:0:0:0:6a"
if( $remote_ip == $client ){
   # do something specific for this client
}
Alternate name: normalizeIPAddress
See also: string.validIPAddress

string.randomBytes( length )

Returns a string of the supplied length filled with random bytes.

# Get a string 16 bytes long filled with random data
$str = string.randomBytes( 16 );
Alternate name: randomBytes

string.regexescape( string )

Returns a version of its parameter suitable for using inside a regex match as a string literal.
All characters in the string that aren't a-z, A-Z, 0-9 or '_' are escaped using a backslash.

$str = "10.100.230.5";
$escaped = string.regexescape( $str );
if( string.regexmatch( $line, $escaped ) ) {
   log.info( "Line matched: " . $str );
}
Alternate name: regexescape
See also: string.escape

string.regexmatch( string, regex, [flags] ) )

Performs a regular expression match on the supplied string. If the regular expression 'regex' contains bracketed sub-expressions, then the variables $1 ... $9 will be set to the matching substrings.
Note that the '\' character is an escape character in TrafficScript strings enclosed with double quotation marks. If you need to put a literal '\' in a regular expression, you must escape it as '\\' or enclose the string in single quotation marks. To match a literal string inside a regular expression use the string.regexEscape function.
The optional 'flags' parameter contains a string of single-letter options. The following options are supported:


It returns 1 if matched, and 0 otherwise.

$id = "user=Joe, password=Secret";
if( string.regexmatch(
   $id, "^user=(.*), password=(.*)$" ) ) {
   log.info( "Got UserID: ".$1.", Password: ".$2 );
}

$name = "Name( Bob )";
string.regexmatch( $name, 'Name\( (\S+) \)' );
log.info( $1 ); # prints Bob
Alternate name: regexmatch
See also: string.wildmatch, string.regexsub, string.regexescape

string.regexsub( string, regex, replacement, [flags] )

Performs a regular expression match on the supplied string, then replaces each matching substring with the supplied replacement. The replacement string may contain $1 .. $9 substitutions, which reference bracketed sub-expressions in the regular expression.
Note that the '\' character is an escape character in TrafficScript strings enclosed with double quotation marks. If you need to put a literal '\' in a regular expression, you must escape it as '\\' or enclose the string in single quotation marks. To match a literal string inside a regular expression use the string.regexEscape function.
The optional 'flags' parameter contains a string of single-letter options. The following options are supported:


string.regexsub() returns the string with the replacements.

# Rewrite incoming URL
$url = string.regexsub($url, "^/(.*)/secure",
                       "/$1/private");


# Remove cookieless session from URL
# e.g. "/(sessionid)/app/index" => "/app/index"
$url = string.regexsub( $url, '/\(\S+\)/', "/" );
Alternate name: regexsub
See also: string.regexmatch

string.replace( string, search, replacement )

Replaces the first occurrence of the search string in the supplied string with the replacement. It is case-sensitive and returns the string with the replacement.

# Rewrite incoming URL
$url = string.replace($url, "/secure", "/private");
Alternate name: replace
See also: string.replaceI, string.replaceAll, string.replaceAllI

string.replaceAll( string, search, replacement )

Replaces all occurrences of the search string in the supplied string with the replacement. It is case-sensitive and returns the string with the replacements.

# Rewrite incoming URL
$url = string.replaceAll($url, "/in", "/out");
Alternate name: replaceAll
See also: string.replaceAllI, string.replace, string.replaceI

string.replaceAllI( string, search, replacement )

Replaces all occurrences of the search string in the supplied string with the replacement. It is case-insensitive and returns the string with the replacements.

# Rewrite incoming URL
$url = string.replaceAllI($url, "/in", "/out");
Alternate name: replaceAllI
See also: string.replaceAll, string.replaceI, string.replace

string.replaceBytes( string, replacement, offset )

Replaces a portion of a string with a replacement string at the supplied offset. It returns a modified version of the original string of the same length as the original with the appropriate bytes replaced from the replacement string.
If offset < 0, or offset > length( string ), or length( replacement ) == 0, string.replaceBytes returns the original string.

# $r = "hi lo"
$r = string.replaceBytes( "hello", "i ", 1 );

# $r = "helwo"
$r = string.replaceBytes( "hello", "world", 3 );
Alternate name: replaceBytes
See also: string.insertBytes

string.replaceI( string, search, replacement )

Replaces the first occurrence of the search string in the supplied string with the replacement. It is case-insensitive and returns the string with the replacement.

# Rewrite incoming URL
$url = string.replaceI($url, "/secure", "/private");
Alternate name: replaceI
See also: string.replace, string.replaceAllI, string.replaceAll

string.reverse( string )

Returns the characters of a string in reverse order.

$c = string.reverse( "esrever" ); # Returns "reverse"
Alternate name: reverse

string.right( string, count )

Returns the last 'count' characters of the provided string. An empty string will be returned if 'count' is less than or equal to zero.

# returns "sh"
$s = string.right( "#!/bin/sh", 2 );
Alternate name: right
See also: string.drop

string.skip( string, count )

Returns all but the first 'count' characters from the input string. An empty string will be returned if 'count' is greater than the length of the original string.

# returns "/bin/sh"
$s = string.skip( "#!/bin/sh", 2 );
Alternate name: skip
See also: string.drop, string.trim

string.split( string, [separator] )

Returns an array containing the substrings of the supplied string that are delimited by the separator. The separator defaults to a space character, so applying this method to a string without supplying the separator character will return an array containing all the individual words in the string.

$words = string.split( http.getResponseBody() );
log.info( "There were " . array.length( $words )
          . " words in the response" );
See also: array.join

string.sprintf( format string, arguments )

Behaves like the C library sprintf() function. Only %s, %c, %d and %f are supported. The function returns the generated string.

$text = string.sprintf(
   "Apples: %3d Oranges: %3d\n",
   $apples, $oranges );
Alternate name: sprintf
See also: string.append

string.startsWith( string, prefix )

Returns 1 if the provided string starts with the given prefix, and 0 otherwise.

if( string.startsWith( $url, "http://" ) ) {
   # URL is of the form http://host/uri ...
}
Alternate name: startsWith
See also: string.startsWithI, string.endsWith, string.contains

string.startsWithI( string, prefix )

Returns 1 if the provided string starts with the given prefix, and 0 otherwise. It is case-insensitive.

if( string.startsWithI( $path, "/tea" ) ) {
   # The path starts with tea ...
}
Alternate name: startsWithI
See also: string.startsWith, string.endsWithI, string.containsI

string.substring( string, base, end )

Returns the substring starting at character position 'base' and ending at position 'end'.
Note that character positions start at 0, and the end position is inclusive.

# Set $s to "is is a"
$s = string.substring( "This is a string", 2, 8 );
Alternate name: substring

string.trim( string )

Returns the result of removing leading and trailing white space (and control characters) from its input

$s = string.trim( " 1234 " ); # returns "1234"
Alternate name: trim
See also: string.skip, string.drop

string.unescape( escaped string )

Returns the escape-decoded version of its parameter.
%-encoded characters are replaced with their decoded versions. %u-encoded characters are replaced with their UTF-8 representation. If there are illegal digits which cannot safely be converted, the variable $1 is set to 0 and the result contains '_' in place of the '%'. Such malicious %-escaped URLs are a common way of attacking unassuming servers or applications, and by handling them in this way, the attack is thwarted, but some information about a suspicious request is retained.

# returns "\r\n100%"
$s = string.unescape("%0D%0A100%25");
# returns "something_BGelse"
$s = string.unescape("something%BGelse");
# returns "file.ida"
$s = string.unescape("file.%u0069%u0064%u0061");
Alternate name: unescape
See also: string.escape, string.hexdecode

string.uppercase( string )

Converts all characters in the provided string to uppercase and returns the result.

$s = string.uppercase("aBcDeFg"); # Returns "ABCDEFG"
Alternate name: uppercase
See also: string.lowercase

string.urlencode( string )

Returns the URL-encoded version of the supplied string to make it safe for including in URLs. It converts anything other than A-Z a-z 0-9 . - _ to percent+hex form. It encodes reserved characters (RFC 3986) and % as well. string.urlencodeexceptreserved() should be used instead to exclude those.

#$url will be
# %2Fcheck%20price%3Famount%3D12%26currency%3D%24
$url = string.urlencode(
             "/check price?amount=12¤cy=$");
Alternate name: urlencode
See also: string.unescape, string.htmlencode

string.urlencodeexceptreserved( string )

Returns the URL-encoded version of the supplied string to make it safe for including in URLs. It converts characters except - unreserved characters A-Z a-z 0-9 . - _ - reserved characters / ? # [ ] @ ! $ & ' ( ) - % according to RFC 3986 to percent+hex form.

# $url will be
# "/check%20price?amount=12¤cy=$"
# where space ' ' gets encoded to %20
# and leaving /, ?, = and $ as they were.
$url = string.urlencodeexceptreserved(
           "/check price?amount=12¤cy=$");
Alternate name: urlencodeexceptreserved
See also: string.unescape, string.htmlencode, string.urlencode

string.validIPAddress( string )

Returns 4 if the string provided is an IPv4 address, 6 if it is an IPv6 address and 0 if it is not a valid IP address.

$ipversion = string.validIPAddress( $x );
if( 4 == $ipversion ) {
   # do something specific to IPv4
} else if( 6 == $ipversion ) {
   # do something specific to IPv6
} else {
   # error: not a valid IP address
}
Alternate name: validIPAddress
See also: string.ipmaskmatch

string.wildmatch( string, pattern )

Performs a shell-like wild match on the supplied string. The pattern may contain the wildcard characters '?' (which matches a single character) and '*' (which matches any substring).
It returns 1 if matched, and 0 otherwise.

$url = http.getPath();
if( string.wildmatch( $url, "*.cgi" ) ) {
   # Is a request for a CGI script ...
}
Alternate name: wildmatch
See also: string.regexmatch

string.gmtime.parse( str )

Parses the supplied string as a time stamp and returns the time in seconds since the epoch (1st Jan 1970). Dates before the epoch or after 2038 will produce unexpected results.
Note: Timezone information contained inside the time string is ignored. The time is always assumed to be in GMT.

# Parse a string into unix time format
$str = "Tue, 21 Oct 2008 13:44:26 GMT";
$time = string.gmtime.parse( $str );
See also: sys.gmtime.format

sys.domainname()

Returns the domain name of the host machine. For example, if the machine is named "server1.example.com", sys.domainname() will return "example.com".

$domainname = sys.domainname();
Alternate name: domainname
See also: sys.hostname

sys.getRestApiPort()

Returns the TCP port number used by the REST API, such as 9070.

# get the REST API port
$restport = sys.getRestApiPort();

# use that to get the root node from the REST API
$body = http.request.get(
              "http://localhost:".$restport."/");

# in this case an 'error: authentication required'
# type response
# will be returned

sys.getenv( variable )

Returns the named environment variable, or the empty string if the environment variable does not exists.

$zeushome = sys.getenv( "ZEUSHOME" );
Alternate name: getenv

sys.getnetworkinterfaces( hash_of_options )

Returns a list of network interfaces on the system, with a hash of the following for each one: Bcast, pppdest, IfName, netmask, MacAddr, IP, up

The following options can be supplied in a hash in order to alter the output:

"include_lo" => [0|1] This option controls whether the list returned should include loopback addresses. (Default: 1)

"up" => [0|1] If 1, only return interfaces marked as UP. If 0, ignore the UP status. (Default: 0)

$info = sys.getnetworkinterfaces( ["include_lo" => 0,
                                  "up" => 1 ] );
if($info)
{
   foreach( $ipinfo in $info ) {
      $ip = $ipinfo["IP"];
      $name = $ipinfo["IfName"];
      $mac = $ipinfo["MacAddr"];
      log.info("---------------------"
             . "\n interface = " . $name
             . "\n IP = " . $ip
             . "\n MAC = " . $mac
            );
   }
}else {
   log.info("No network interfaces returned");
}

sys.getpid()

Returns the process id of the current process.

$mypid = sys.getpid();
Alternate name: getpid

sys.hostname()

Returns the hostname of the host machine. For example, if the machine is named "server1.example.com", sys.hostname() will return "server1".

$hostname = sys.hostname();
Alternate name: hostname
See also: sys.domainname

sys.isFIPS()

Returns 1 if the traffic manager is operating in FIPS Mode, otherwise it returns 0.

if( sys.isFIPS() ) {
   # FIPS Mode is in operation
}

sys.time()

Returns the current system time as the number of seconds since midnight, 1/1/1970.

$unixtime = sys.time();
Alternate name: time
See also: sys.timeToString, sys.localtime.format, sys.gmtime.format, sys.time.highres

sys.timeToString( unixtime )

Takes the time in seconds since midnight, 1/1/1970 and if the optional unixtime parameter is provided, returns a formatted string representing that time. If the unixtime parameter is not given, it returns the current time as a formatted string.

# Returns "[01/Feb/2004:12:24:51 +2000]"
$tm = sys.timeToString( sys.time() );
Alternate name: timeToString
See also: sys.time

sys.gmtime.format( format, unixtime )

Converts the time into a string format. This function converts using GM time - see sys.localtime.format() to convert using localtime.

FormatMeaningFormatMeaning
%aMon Tue Wed ...%AMonday Tuesday ...
%bJan Feb Mar ...%BJanuary February ...
%dDay of month "01"-"31"%D%m/%d/%y
%eDay of month " 1"-"31"%HHour of day "00-23"
%hEquivalent to %b%IHour of day "01" - "12"
%jJulian day of the year "001" to "366"%mMonth of year "01" - "12"
%MMinute "00" - "59"%nNewline character
%pAM/PM%rTime in %I:%M:%S [AM|PM]
%R%H:%M%SSeconds, output as a number between "00" and "61"
%tTab character%T%H:%M:%S
%uDay of week (1 = Monday, 7 = Sunday)%wDay of week (0 = Sunday, 6 = Saturday)
%yYear (without century) "00" to "99"%YYear "0000" to "9999"
%ZTime zone ("GMT")%%"%"

If supplied, the optional 'unixtime' parameter specifies the number of seconds since midnight 1/1/1970, and the function returns a formatted string representing that time. If the 'unixtime' value is not provided, the current time will be returned.

# Return a time suitable for an HTTP header
# e.g. Mon, 14 Aug 2006 12:39:01 GMT
$str = sys.gmtime.format( "%a, %d %b %Y %T GMT" );
Alternate name: gmtime.format
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.month, sys.time.year, sys.time.yearday, sys.localtime.format, string.gmtime.parse

sys.localtime.format( format, unixtime )

Converts the time into a string format. This function converts using localtime - see sys.gmtime.format() to convert using GMT.

FormatMeaningFormatMeaning
%aMon Tue Wed ...%AMonday Tuesday ...
%bJan Feb Mar ...%BJanuary February ...
%dDay of month "01"-"31"%D%m/%d/%y
%eDay of month " 1"-"31"%HHour of day "00-23"
%hEquivalent to %b%IHour of day "01" - "12"
%jJulian day of the year "001" to "366"%mMonth of year "01" - "12"
%MMinute "00" - "59"%nNewline character
%pAM/PM%rTime in %I:%M:%S [AM|PM]
%R%H:%M%SSeconds, output as a number between "00" and "61"
%tTab character%T%H:%M:%S
%uDay of week (1 = Monday, 7 = Sunday)%wDay of week (0 = Sunday, 6 = Saturday)
%yYear (without century) "00" to "99"%YYear "0000" to "9999"
%ZTime zone (from $TZ)%%"%"

If supplied, the optional 'unixtime' parameter specifies the number of seconds since midnight 1/1/1970, and the function returns a formatted string representing that time. If the 'unixtime' value is not provided, the current time will be returned.

# Return a formatted string
# e.g. Mon, 14 Aug 2006 12:39:01 EST
$str = sys.localtime.format( "%a, %d %b %Y %T EST" );
Alternate name: localtime.format
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.month, sys.time.year, sys.time.yearday, sys.gmtime.format

sys.time.highres()

Returns the current system time as the number of seconds and microseconds since midnight, 1/1/1970. The value is returned as a double, e.g. 1138417190.823265

$time = sys.time.highres();
Alternate name: time.highres
See also: sys.timeToString, sys.localtime.format, sys.gmtime.format, sys.time

sys.time.hour( unixtime )

Returns the hour of the day in local time (0-23).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$hour = sys.time.hour();
Alternate name: time.hour
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.weekday, sys.time.monthday, sys.time.yearday, sys.time.month, sys.time.year, sys.localtime.format

sys.time.minutes( unixtime )

Returns the minutes after the hour in local time (0-59).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$mins = sys.time.minutes();
Alternate name: time.minutes
See also: sys.time, sys.time.seconds, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.yearday, sys.time.month, sys.time.year, sys.localtime.format

sys.time.month()

Returns the month of the year in local time (1-12).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

# Find out what the month is tomorrow.
$month = sys.time.month( sys.time() + 86400);
Alternate name: time.month
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.yearday, sys.time.year, sys.localtime.format

sys.time.monthday( unixtime )

Returns the day of the month in local time (1-31).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$dayofmonth = sys.time.monthday();
Alternate name: time.monthday
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.yearday, sys.time.month, sys.time.year, sys.localtime.format

sys.time.seconds( unixtime )

Returns the seconds after the minute in local time. Normally, it returns a number in the range of (0-59), but can be up to 61 to allow for leap seconds.

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$secs = sys.time.seconds();
Alternate name: time.seconds
See also: sys.time, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.yearday, sys.time.month, sys.time.year, sys.localtime.format

sys.time.weekday( unixtime )

Returns the day of the week in local time (1-7). Sunday has the value 1; Saturday has the value 7.

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$dayofweek = sys.time.weekday();
Alternate name: time.weekday
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.monthday, sys.time.yearday, sys.time.month, sys.time.year, sys.localtime.format

sys.time.year( unixtime )

Returns the year in local time (1970-2038).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$year = sys.time.year();
Alternate name: time.year
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.yearday, sys.time.month, sys.localtime.format

sys.time.yearday( unixtime )

Returns the day of the year in local time (1-366).

If optional parameter 'unixtime' is supplied, then this specifies the time since midnight 1/1/1970 otherwise the current time will be used.

$dayofyear = sys.time.yearday();
Alternate name: time.yearday
See also: sys.time, sys.time.seconds, sys.time.minutes, sys.time.hour, sys.time.weekday, sys.time.monthday, sys.time.month, sys.time.year, sys.localtime.format

tcp.close( sock )

Close a previously opened TCP socket. A non-zero return value indicates a successful close, if 0 is returned then an error occured and an error string will be in '$1'.

If a rule fails to close a TCP socket, it will be closed automatically when the Virtual Server connection finishes.

$sock = tcp.connect( "10.100.1.5", 7 );
tcp.close( $sock );
See also: tcp.connect, tcp.write, tcp.read

tcp.connect( ip, port, [timeout] )

Create a new TCP socket to the supplied IP address and port. This function will return a socket handle that can be used by other tcp.* functions. The created TCP socket is unique to this connection, and can't be used by other connections.

An optional timeout can be specified in milliseconds. If a connection has not been established within this time the function will return 0 and $1 will be set to "timeout".

Note that if the Virtual Server connection times out before this socket has been established then the connection will be terminated.

Returns 0 on error (with an error message in $1).

$sock = tcp.connect( "::1", 3306 );
if( ! $sock ) {
   log.error( "Error: " . $1 );
}
See also: tcp.write, tcp.read, tcp.close

tcp.read( socket, maximum, [timeout] )

Read data from a previously opened TCP connection. The function waits until data is available on the TCP socket, and will then return the available data (up to the specified 'maximum'). If an error occurs an empty string will be returned and $1 will contain an error message, or 0 if the connection has been closed.

An optional timeout can be specified in milliseconds. If a no data has been read within this time the function will return an empty string and $1 will be set to "timeout".

Note that if the Virtual Server connection times out before any data has been read then the connection will terminated.

# Read from a TCP socket, ensuring we get 1024 bytes
$amount = 1024;
$buf = '';
while( string.len( $buf ) != $amount ) {
   $data = tcp.read( $sock, $amount -
                     string.len( $buf ) );

   if( $data == "" ) {
       $buf = '';
       break;
   }
   $buf .= $data;
}
See also: tcp.connect, tcp.write, tcp.close

tcp.write( socket, data, [timeout] )

Writes all of the supplied data to a TCP socket. The function will return the number of bytes written. If an error occurs then -1 will be returned and $1 will contain error message.

An optional timeout can be specified in milliseconds. After this time the number of bytes written will be returned and $1 will contain 'timeout'.

Note that if the Virtual Server connection times out before the data has been written then the connection will terminated.

$sock = tcp.connect( "10.100.1.5", 7 );
tcp.write( $sock, "Ping\n" );
See also: tcp.connect, tcp.read, tcp.close

xml.validate( document, DTD ) (deprecated)

Validates an XML document against a DTD. It returns 1 if the document validated correctly, and 0 if it did not. It returns -1 if there was an error parsing the XML document or the DTD.
The XML processing functionality must be enabled by the software license.

This function has been deprecated; xml.validate.dtd should be used instead.

xml.validate.dtd( document, DTD )

Validates an XML document against a DTD. It returns 1 if the document validated correctly, and 0 if it did not. It returns -1 if there was an error parsing the XML document or the DTD.
The XML processing functionality must be enabled by the software license.

# Validate the HTTP body against the DTD stored in
# the resource 'mydtd'
$theDoc = http.getBody( 0 );
$theDTD = resource.get( "mydtd" );
if( xml.validate.dtd( $theDoc, $theDTD ) != 1 ) {
   # validation failed ...
}
See also: xml.validate.xsd

xml.validate.xsd( document, schema )

Validates an XML document against an XML schema. It returns 1 if the document validated correctly, and 0 if it did not. It returns -1 if there was an error parsing the XML document or the schema.
If the schema against which the document is being validated needs to import another schema file, it will search for it inside Catalog > Extra Files > Miscellaneous Files.
The XML processing functionality must be enabled by the software license.

# Validate the HTTP body against the schema stored in
# the resource 'myschema'
$theDoc = http.getBody( 0 );
$theSchema = resource.get( "myschema" );
if( xml.validate.xsd( $theDoc, $theSchema ) != 1 ) {
   # validation failed ...
}
See also: xml.validate.dtd

xml.xpath.matchNodeCount( doc, nspacemap, query )

Applies an XPath query to the supplied XML document. It returns the number of entries in the result node set.
The function will return -1 if there was an error parsing the XML document, XML namespace or XPath query.
Namespaces can be used in the XPath query by defining them in the nspacemap parameter. This parameter is specified as a space-separated list of identifiers mapped to namespaces. For example, specifying 'xmlns:myns=http://www.example.com/mynamespace' allows you to use the identifier 'myns' in the XPath query to find elements in the 'http://www.example.com/mynamespace' namespace within the XML document.
The XML processing functionality must be enabled by the software license.

# A sample XML document
$theDoc =
'
    xmlns:recent="http://www.example.com/newitems">

    Item 1
    Item 2
    Item 3
    Item 4
 

';

# How many items are in the 'newitems' namespace
# under the 'mybook' element of the 'book' namespace?
# Note: namespace identifiers in the XPath query
# do not have to be the same as those used in the XML
# document itself.
$items = xml.xpath.matchNodeCount(
   $theDoc,
   "xmlns:book=http://www.example.com/book ".
   "xmlns:new=http://www.example.com/newitems",
   "//book:mybook/new:item"
);

# $items = 2
See also: xml.xpath.matchNodeSet

xml.xpath.matchNodeSet( doc, nspacemap, query )

Applies an XPath query to the supplied XML document. It returns a string representation of the result node set.
The function will return an empty string if there was an error parsing the XML document, XML namespace or XPath query.
Namespaces can be used in the XPath query by defining them in the nspacemap parameter. This parameter is specified as a space-separated list of identifiers mapped to namespaces. For example, specifying 'xmlns:myns=http://www.example.com/mynamespace' allows you to use the identifier 'myns' in the XPath query to find elements in the 'http://www.example.com/mynamespace' namespace within the XML document.
The XML processing functionality must be enabled by the software license.

# A sample XML document
$theDoc =
'
    xmlns:recent="http://www.example.com/newitems">

    Item 1
    Item 2
 

';

# Get the value of the 'item' node in the 'newitems'
# namespace under the 'mybook' element of the 'book'
# namespace.
# Note: namespace identifiers in the XPath query
# do not have to be the same as those used in the XML
# document itself.
$set = xml.xpath.matchNodeSet(
   $theDoc,
   "xmlns:book=http://www.example.com/book ".
   "xmlns:new=http://www.example.com/newitems",
   "//book:mybook/new:item/text()"
);

# $set = 'Item 2'
See also: xml.xpath.matchNodeCount

xml.xslt.transform( document, stylesheet )

Performs an XSLT transformation on a XML document. It returns the transformed document, or -1 on failure.
The XML processing functionality must be enabled by the software license.

# Perform XSLT transformation on supplied POST XML
# data, and return the HTML result to the client.
$response = xml.xslt.transform( http.getbody( 0 ),
   resource.get( "people.xsl" ));
http.sendResponse( "200 OK", "text/html",
   $response, "" );

Conditions

Remote IP Address
This is the IP address of the client who is connecting to the traffic manager.
Local IP Address
This is the IP address on the traffic manager which the client connects to.
Remote Port
This is the port on the client machine from which the connection was made.
Note that we do not need a corresponding Local Port option as this is determined by the virtual server to which the connection was made.
Cookie
When supplied with a cookie name this will return the value of that cookie for the http connection. If the cookie does not exist, this will return the empty string.
HTTP Header
When supplied with an HTTP header name this will return the value of that header for the http connection, or the empty string if the header does not exist or has an empty value. The header name is automatically translated into the proper case for the lookup.
HTTP Method
This is the HTTP method used for the connection. Choosing this modifies the expression for the condition to offer the choices GET or POST.
Query String
This is the portion of the request URL after the '?'. This will return the empty string if no query string was provided.
For example, a raw url of http://www.example.com/content?page=44 will be returned as page=44.
URL Path
This returns the %-decoded path in the HTTP request URL, stripping the query string if one was provided. If there is a leading scheme and authority prefix, this is removed as well.
For example, a raw url of http://www.example.com/content?page=44 will be returned as /content.
Raw URL
This is the full URL of the client request provided in the first line of the HTTP request, after the method and before the HTTP version specifier. The raw URL data includes both the path and query string if supplied and is not decoded. It could contain %-escaped characters that can be used to disguise the contents of the URL. Similarly, the file path in the URL could be non-normalised and may contain '.' and '..' references, such as /sales//.././../../etc/passwd.
HTTP Version
This is the version of the HTTP protocol specified in the client request. Choosing this modifies the expression for the condition to offer the choices 1.0 and 1.1.
HTTP Response Body
This is the body data of an HTTP request.
HTTP Response Header
This is the value of a named HTTP header in the HTTP response, or the empty string if the header does not exist or has an empty value. The header name is automatically translated into the proper case for the lookup.
HTTP Response Code
This is the status code from the first line of the HTTP response.
Response Body
Returns the number of bytes of content that you have specified to read from the body of the response.
Warning: you can stall a connection by asking it to read more data than the remote client will provide.
SIP Version
This is the version of the SIP protocol being used.
SIP Method
This is the SIP method of the request.
SIP Request Body
This is the body of the SIP request.
SIP Request Header
This is a header from the SIP request.
SIP Request URI
This is the target of the SIP request.
SIP Response Body
This is the body of the SIP response.
SIP Response Header
This is a header from the SIP response.
SIP Response Code
This is the status code of the SIP response.
RTSP Version
This is the version of the RTSP protocol being used.
RTSP Method
This is the RTSP method of the request.
RTSP Request Body
This is the body of the RTSP request.
RTSP Request Header
This is a header from the RTSP request.
RTSP Request Path
This is the path portion of the RTSP request's URL field.
RTSP Request Raw URL
This is the raw URL data provided by the client.
RTSP Response Body
This is the body of the RTSP response.
RTSP Response Header
This is a header from the RTSP response.
RTSP Response Code
This is the status code of the RTSP response.

Actions

Log Error
This logs out the supplied value to the error log with the severity of an error.
Log Warning
This logs out the supplied value to the error log with the severity of a warning.
Log Information
This logs out the supplied value to the error log for your information, not as an error.
Emit Event
This generates an event, which can then trigger a set of configurable actions.
Set Persistence
Picks a Session Persistence class to associate with this request.
Set SLM
Picks a Service Level Monitoring class to associate with this request.
HTTP Redirect
Sends a redirect response to the client to the URL supplied.
Change HTTP site
Redirects the client to the given web site, if needed.
Set Response Bandwidth
Picks a Bandwidth class to control the response data that is sent to the client.
Drop Connection
This drops the current connection being processed by the rule.
Run Java Extension
This runs a Java servlet.
Add Header
This adds a header to the HTTP request. If the header already exists in the response, then this value will be appended to the existing value. The header name is automatically translated to the correct case before it is added.
For example, to add a missing Host header set Header Name = Host and Value = unknown.
Set Header
This sets a header in the HTTP request. If the header already exists, then it will be replaced with this new value. The header name is automatically translated to the correct case before it is added.
Delete Header
This deletes a header in the HTTP request.
Permit Request Headers
This removes all HTTP headers except those supplied as a space separated list.
Set Request Bandwidth
Picks a Bandwidth class to control the data that is sent to the server.
Set Rate Shaping
Picks a Rate Shaping class to control requests.
Choose Pool
This selects a pool to send the incoming request to and exits the rule immediately.
Set Query String
This replaces the query string of the request with the supplied value. Any control characters in the replacement are %-encoded.
Set URL Path
This replaces the URL path portion of the incoming HTTP request. If the replacement value contains a '?', this will also replace the query string; otherwise, any query string is preserved. Any control characters are %-encoded in the replacement value.
For example, setting New Path = /purchase?product=widget will replace the URL path and the query string.
Rewrite URL Path
This performs a regular expression match on the URL path using the supplied pattern and then replaces each matching substring with the supplied replacement. The replacement string may contain $1 .. $9 substitutions, which reference bracketed sub-expressions in the regular expression.
For example, setting Pattern = ^/secure and Replacement = /private will replace each URL path starting with /secure by a URL path starting with /private.
Add Response Header
This adds a header to the HTTP response. If the header already exists, then this value will be appended to the existing value. The header name is automatically translated to the correct case before it is added.
For example, setting Header Name = Set-Cookie and Value = "id=12345678; path=/" will add an id cookie with value 12345678.
Set Response Header
This sets a header in the HTTP response. If the header already exists, then it will be replaced with this new value. The header name is automatically translated to the correct case before it is added.
Delete Response Header
This removes the named HTTP header from the HTTP response. The header name is automatically translated to the correct case.
Set Response Cookie
This sets the value of the named cookie in the HTTP response. If the named cookie already exists, this replaces its value.
Delete Response Cookie
This removes the named cookie from the HTTP response
Permit Response Headers
This removes all HTTP headers except those supplied as a space separated list.
Make Response uncacheable
Sets appropriate HTTP response headers to prevent the traffic manager or other caches from caching the response.
Set Response cache time
Allows a response to be cached, and sets the time that it can be cached for.
Prepend SIP Request Header
This adds a header field to the front of SIP request's header.
Append SIP Request Header
This adds a header field to the end of SIP request's header.
Set SIP Request Header
Sets one of the request's SIP Header fields.
Remove SIP Request Header
Removes the specified header field from a SIP request.
Set SIP Request Method
Sets the SIP method to use when forwarding the request via a pool to a node.
Set SIP Request URI
Sets the target URI of the SIP request.
Send SIP Response
Closes the connection and sends back a reponse with the specified response code and message.
Prepend SIP Response Header
This adds a header field to the front of SIP response's header.
Append SIP Response Header
This adds a header field to the end of SIP response's header.
Set SIP Response Header
Sets one of the response's SIP Header fields.
Remove SIP Response Header
Removes the specified header field from a SIP response.
Set SIP Response Code
Sets the status code and message of the SIP response.
Add RTSP Request Header
This adds a header field to the RTSP request's header.
Set RTSP Request Header
Sets one of the RTSP request's Header fields.
Remove RTSP Request Header
Removes the specified header field from a RTSP request.
Set RTSP Method
Sets the method of the RTSP request.
Set RTSP Path
Sets the path portion of the request's URL with the specified string.
Send RTSP Response
Closes the connection and sends back a reponse with the specified response code and message.
Add RTSP Response Header
This adds a header field to the RTSP response's header.
Set RTSP Response Header
Sets one of the RTSP response's Header fields.
Remove RTSP Response Header
Removes the specified header field from a RTSP response.
Set RTSP Response Code
Sets the status code and message of the RTSP response.

Release Notes
The release notes provide useful information regarding the current release of Stingray Traffic Manager, including an overview of the changes made.
Getting Started
The Getting Started manual introduces Stingray, and describes how to install and use the software for the first time.
Appliance Getting Started Guide
The Virtual Appliance Getting Started Guide describes how to set up and configure a Stingray Appliance for the first time.
EC2 Getting Started Guide
The Getting Started manual introduces Stingray, and describes how to setup and use the software for the first time.
Appliance Getting Started Guide
The Appliance Getting Started Guide describes how to set up and configure a Stingray Appliance for the first time.
Appliance License Acknowledgements
Stingray Appliance License Acknowledgements provides a complete set of license attributions for all third party software packages present in the Appliance Operating System.
User Manual
The User Manual describes the features and capabilities of Stingray in detail.
TrafficScript Guide
The TrafficScript Guide describes syntax and features of the TrafficScript language, used for creating traffic management rules in Stingray.
Stingray Control API Manual
The Stingray Control API Manual provides a full reference for the Control API, used for remotely managing your Stingray cluster.
Stingray REST API Guide
The Stingray REST API Guide provides a description of how to use the REST API to remotely manage your traffic manager configuration.
Java Development Guide
The Java Development Guide describes Java Extensions, used for extending TrafficScript with the Java language and libraries.
Java API Documentation
The Java API Documentation describes the Stingray Java Extensions API, in the standard Javadoc format.
Configuration System Guide
The Configuration System Guide describes the configuration used by all variants of Stingray Traffic Manager. It is primarily intended to aid those using the 'zconf' utility.

Stingray Interface Libraries

Stingray SNMP MIB (SMIv2, for SNMPv2c and SNMPv3 clients)
Stingray SNMP MIB (SMIv1, for SNMPv1 clients)
The MIB (Management Information Base) provides definitions of all variables available for monitoring through a suitable external SNMP client. To download the MIB, right-click the link above and choose "save link as".
Stingray Control API WSDL Files
The Control API WSDL files describe the Control API in a format that tools can parse and produce an interface for your programming language.
Java Servlet API
This JAR file contains the Java Servlet API, the standard API for writing servlets, such as Stingray Java Extensions.
Stingray Java Extensions API
This JAR file contains the Stingray Java Extensions API, which adds Stingray-specific functionality to the Servlet API.

For more documentation, worked examples and code samples, visit the Riverbed Stingray Community.


The Riverbed Stingray Community is a comprehensive online resource that has been launched to cater for the growing number of Stingray users.

The Riverbed Stingray Community provides a forum for potential and existing customers to share their experiences, and highlights some of the innovative ways that Stingray has been used to solve real-world application traffic management problems.

For real examples, code samples and articles, visit the Riverbed Stingray Community.


Where are the WSDL files?

A compressed archive of all the WSDL files can be downloaded here:

The WSDL files cannot be found. Please contact your Support Provider for further information.

Stingray Control API Manual
The Stingray Control API Manual provides a full reference for the Control API, used for remotely managing your Stingray cluster.

Default error page for HTTP based services :

Service Unavailable

The service is temporarily unavailable. Please try again later.

Default error page for SIP based services:

The service is temporarily unavailable. Please try again later.

No error page will be sent to the client for services other than HTTP and SIP for the "Default" option in error_file setting.