Add Rules to a Load Balancer
- Name
post
- Type
- /v1/load_balancers/:uuid/rules
- Description
Send a
POST
request to add a load balancer rules.
Request
Attributes
The request must contain at least one forwarding rule
. The load balancer's rules
attribute is made up of an array of objects with the following attributes:
Required
- Name
protocol
- Type
- string
- Description
The protocol which the health checks use in order to sent connection attempt to the backend Stacklets. The possible values are: "http", "https", "http2", or "tcp".
- Name
source_port
- Type
- integer
- Description
The port on which the load balancer instance will listen.
- Name
target_port
- Type
- integer
- Description
The port on the backend Stacklets to which the load balancer will send traffic to.
Optional
- Name
certificate_id
- Type
- integer
- Description
The ID of the TLS certificate used for SSL termination.
- Name
tls_passthrough
- Type
- boolean
- Description
A value indicating whether the SSL encrypted traffic will be passed through to the backend Stacklets. Default value for this attribute is false.
Example
curl -X POST "https://api.simplystack.com/v1/load_balancers/21848c7e-0389-4fdf-95bf-7d4d58d62c22/rules" \
-H "Content-Type: application/json" \
-H "Authorization: Token d359ad9cc9422b5ff07aede0cd2707da4ff82be0" \
-d '{"rules": [{"protocol": "http","source_port": 80,"target_port": 80,"certificate_id": null,"tls_passthrough": false}]}'
Response
Rules Attributes
When the rules
object is returned, the Forwarding rules determine how traffic will be routed from the load balancer to the Stacklets assigned to it. They can be used to configure the type of traffic (HTTP, HTTPS, or TCP) and to map ports on the load balancer to ports on the Stacklets. For SSL encrypted traffic, the user may also configure whether to use SSL termination at the load balancer (by specifying an SSL certificate) or to pass the encrypted traffic through to the Stacklet. The following are the returned attributes:
Example
{
"rules": [
{
"protocol": "http",
"source_port": 80,
"target_port": 80,
"certificate_id": null,
"tls_passthrough": false
}
]
}