How to Manage Forwarding Rules on a Vultr Load Balancer

Updated on January 6, 2025

Forwarding rules on a Vultr Load Balancer define how incoming traffic is directed to your backend servers. These rules allow you to specify a protocol, port, and target protocol/port for routing requests. By configuring forwarding rules, you can manage and optimize how traffic is distributed, enhancing the performance and accuracy of your load balancing setup.

Follow this guide to manage forwarding rules on a Vultr Load Balancer using the Vultr Customer Portal, API, or CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and click Load Balancer.

  2. Click your target Load Balancer to open its management page.

  3. Click Configuration.

  4. Click Forwarding Rules on the left navigation menu.

  5. Verify or modify the default forwarding rules.

  6. Click Add another rule to set up a new forwarding rule.

  7. Click the Protocol drop-down and select your target protocol from the list of options.

    Set up a new forwarding rule

    • HTTP: Forwards traffic using the Hypertext Transfer Protocol (HTTP).
    • HTTPS: Forwards traffic using the Hypertext Transfer Protocol Secure (HTTPS). Enablng HTTPS rules requires an SSL certificate linked to the Vultr Load Balancer instance.
    • TCP: Forwards traffic using the Transmission Control Protocol (TCP).
  8. Enter the destination Load Balancer port and the target instance port in the respective Port fields.

  9. Click Save Changes to apply the forwarding rules.

  1. Send a GET request to the List Load Balancer endpoint and note the target Load Balancer's ID.

    console
    $ curl "https://api.vultr.com/v2/load-balancers" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a PATCH request to the Update Load Balancer endpoint to add new forwarding rules to the target Load Balancer.

    console
    $ curl "https://api.vultr.com/v2/load-balancers/<loadbalancer-id>/forwarding-rules" \
        -X POST \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{
            "frontend_protocol": "<loadbalancer-protocol>",
            "frontend_port": <loadbalancer-port>,
            "backend_protocol": "<instance-protocol>",
            "backend_port": <instance-port>
    }'
    
  1. List all available instances and note the target Vultr Load Balancer ID.

    console
    $ vultr-cli load-balancer list
    
  2. Add new forwarding rules to the target load balancer.

    console
    $ vultr-cli load-balancer forwarding create <loadbalancer-id> --frontend-port 80 --frontend-protocol http --backend-port 80 --backend-protocol http