Session persistence

Session persistence is a feature of the load balancing service that forces multiple requests, of the same protocol, from clients to be directed to the same node. This is common with many web applications that do not inherently share application state between back-end servers.

Note

  • Changing the protocol for a load balancer will disable session persistence.

  • If you try to DELETE the session persistence configuration when session persistence is already disabled, a 422 response (unprocessableEntity) is returned.

These session persistence modes are available:

Table. Session persistence modes

Name

Description

HTTP_COOKIE

A session persistence mechanism that inserts an HTTP cookie and is used to determine the destination back-end node. This is supported for HTTP load balancing only.

SOURCE_IP

A session persistence mechanism that keeps track of the source IP address that is mapped and is able to determine the destination back-end node. This is supported for HTTPS pass-through and HTTP load balancing only.

SSL_ID

A session persistence mechanism that 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.

You can only set one of the session persistence modes on a load balancer, and it can only support one protocol. If you set HTTP_COOKIE mode for an HTTP load balancer, it supports session persistence for HTTP requests only. Likewise, if you set SOURCE_IP mode for an HTTPS load balancer, it supports session persistence for only HTTPS requests.

To support session persistence for both HTTP and HTTPS requests concurrently, choose one of the following options:

  • Use two load balancers, one configured for session persistence for HTTP requests and the other configured for session persistence for HTTPS requests. That way, the load balancers support session persistence for both HTTP and HTTPS requests concurrently, with each load balancer supporting one of the protocols. In this case, the two load balancers need to share a common Virtual IP.

  • Use one load balancer, configure it for session persistence for HTTP requests, and then enable SSL termination for that load balancer. The load balancer supports session persistence for both HTTP and HTTPS requests concurrently.

Note

  • SSL session ID persistence (SSL_ID) 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 HTTP method if applicable.

Show session persistence configuration

GET /v1.0/{account}/loadbalancers/{loadBalancerId}/sessionpersistence

Shows the session persistence configuration.

The following table shows the possible response codes for this operation:

Response Code

Name

Description

200

Success

Request succeeded.

400

Bad Request

The request is missing one or more elements, or the values of some elements are invalid.

401

Unauthorized

You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.

404

Not Found

The requested item was not found.

413

Over Limit

The number of items returned is above the allowed limit.

422

ImmutableEntity

This fault is returned when a user attempts to modify an item that is not currently in a state that allows modification. For example, load balancers in a status of PENDING_UPDATE,BUILD, or DELETED may not be modified.

500

Load Balancer Fault

The load balancer has experienced a fault.

503

Service Unavailable

The service is not available.

Request

The following table shows the URI parameters for the request:

Name

Type

Description

{account}

String

The ID for the tenant or account in a multi- tenancy cloud.

{loadBalancerId}

String

The ID for the load balancer.

This operation does not accept a request body.

Response

Example Show session persistence configuration: XML response

<sessionPersistence xmlns="http://docs.openstack.org/loadbalancers/api/v1.0" persistenceType="HTTP_COOKIE"/>

Example Show session persistence configuration: JSON response

{
   "sessionPersistence":{
      "persistenceType":"HTTP_COOKIE"
   }
}

Example Show atom session persistence configuration: ATOM/XML response

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <link rel="next"
          href="https://ord.loadbalancers.api.rackspacecloud.com/v1.0/1234/loadbalancers/141/sessionpersistence.atom?page=2"/>
    <title type="text">Session Persistence Feed</title>
    <id>1234-loadbalancers-141-sessionpersistence</id>
    <author>
        <name>Rackspace Cloud</name>
    </author>
    <entry>
        <title type="text">Session Persistence Successfully Updated</title>
        <summary type="text">Session persistence successfully updated to 'HTTP_COOKIE'</summary>
        <author>
            <name>tvardema</name>
        </author>
        <link href="https://ord.loadbalancers.api.rackspacecloud.com/v1.0/1234/loadbalancers/141/sessionpersistence"/>
        <id>1234-loadbalancers-141-sessionpersistence-201142028460</id>
        <category term="UPDATE"/>
        <updated>2011-02-11T00:28:46.000Z</updated>
    </entry>
</feed>

Enable session persistence

PUT /v1.0/{account}/loadbalancers/{loadBalancerId}/sessionpersistence

Enables session persistence.

The following table shows the possible response codes for this operation:

Response Code

Name

Description

202

Success

Request succeeded.

400

Bad Request

The request is missing one or more elements, or the values of some elements are invalid.

401

Unauthorized

You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.

404

Not Found

The requested item was not found.

413

Over Limit

The number of items returned is above the allowed limit.

422

ImmutableEntity

This fault is returned when a user attempts to modify an item that is not currently in a state that allows modification. For example, load balancers in a status of PENDING_UPDATE,BUILD, or DELETED may not be modified.

500

Load Balancer Fault

The load balancer has experienced a fault.

503

Service Unavailable

The service is not available.

Request

The following table shows the URI parameters for the request:

Name

Type

Description

{account}

String

The ID for the tenant or account in a multi- tenancy cloud.

{loadBalancerId}

String

The ID for the load balancer.

The following table shows the body parameters for the request:

Name

Type

Description

persistenceType

String (Required)

Mode in which session persistence mechanism operates. See the session persistence modes table for the available modes.

Example Enable session persistence: XML request

<sessionPersistence xmlns="http://docs.openstack.org/loadbalancers/api/v1.0" persistenceType="HTTP_COOKIE"/>

Example Enable session persistence: JSON request

{
   "sessionPersistence":{
      "persistenceType":"HTTP_COOKIE"
   }
}

Response

This operation does not return a response body.

Disable session persistence

DELETE /v1.0/{account}/loadbalancers/{loadBalancerId}/sessionpersistence

Disables session persistence.

The following table shows the possible response codes for this operation:

Response Code

Name

Description

202

Success

Request succeeded.

400

Bad Request

The request is missing one or more elements, or the values of some elements are invalid.

401

Unauthorized

You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.

404

Not Found

The requested item was not found.

413

Over Limit

The number of items returned is above the allowed limit.

422

ImmutableEntity

This fault is returned when a user attempts to modify an item that is not currently in a state that allows modification. For example, load balancers in a status of PENDING_UPDATE,BUILD, or DELETED may not be modified.

500

Load Balancer Fault

The load balancer has experienced a fault.

503

Service Unavailable

The service is not available.

Request

The following table shows the URI parameters for the request:

Name

Type

Description

{account}

String

The ID for the tenant or account in a multi- tenancy cloud.

{loadBalancerId}

String

The ID for the load balancer.

This operation does not accept a request body.

Response

This operation does not return a response body.