How to Manage Forwarding Rules for Vultr Load Balancer

Updated on September 25, 2024

Forwarding Rules in Vultr Load Balancer define how incoming traffic is directed to your backend servers. These rules specify conditions such as URL paths or hostnames, ensuring that requests are routed efficiently and appropriately to the right servers. By configuring forwarding rules, you can manage and optimize how traffic is distributed based on specific criteria, enhancing the performance and accuracy of your load balancing setup.

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

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

    Load Balancer option in products menu

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

    Selection of a target Load Balancer

  3. Click Configuration.

    Button to open Load Balancer configuration window

  4. Click Forwarding Rules.

    Button to open Forwarding Rules window

  5. Click Add another rule and configure forwarding rules.

    Fields to add forwarding rules for the Load Balancer

  6. Click Save Changes.

    Button to save Load Balancer forwarding rules changes

  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 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": "http",
            "frontend_port": 8080,
            "backend_protocol": "http",
            "backend_port": 80
    }'
    
  1. List the available Load Balancers and note the target Load Balancer's ID.

    console
    $ vultr-cli load-balancer list
    
  2. Add 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