pydo.load_balancers.add_forwarding_rules()

Generated on 8 May 2026 from pydo version v0.34.0

Usage

client.load_balancers.add_forwarding_rules(
    lb_id="4de7ac8b-495b-4884-9a69-1050c6793cd6",
    body={
        "forwarding_rules": [...],
    },
)
Returns NoneRaises HttpResponseError

Description

To add an additional forwarding rule to a load balancer instance, send a POST request to /v2/load_balancers/{lb_id}/forwarding_rules. In the body of the request, there should be a forwarding_rules attribute containing an array of rules to be added.

No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data.

Parameters

lb_id string required

A unique identifier for a load balancer.

Min: 1

forwarding_rules array of objects required
Show child properties
entry_protocol string required

The protocol used for traffic to the load balancer. The possible values are: http, https, http2, http3, tcp, or udp. If you set the entry_protocol to udp, the target_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

One of: http, https, http2, http3, tcp, udp

entry_port integer required

Example: 443

An integer representing the port on which the load balancer instance will listen.

target_protocol string required

The protocol used for traffic from the load balancer to the backend Droplets. The possible values are: http, https, http2, tcp, or udp. If you set the target_protocol to udp, the entry_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

One of: http, https, http2, tcp, udp

target_port integer required

Example: 80

An integer representing the port on the backend Droplets to which the load balancer will send traffic.

certificate_id string optional

Example: 892071a0-bb95-49bc-8021-3afd67a210bf

The ID of the TLS certificate used for SSL termination if enabled.

tls_passthrough boolean optional

Example: False

A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "forwarding_rules": [
    {
      "entry_protocol": "https",
      "entry_port": 443,
      "target_protocol": "http",
      "target_port": 80,
      "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
      "tls_passthrough": False
    }
  ]
}

resp = client.load_balancers.add_forwarding_rules(lb_id="1fd32a", body=req)

More Information

See /v2/load_balancers/{lb_id}/forwarding_rules in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.