List Domain Forwarding Record

Use the List Domain Forwarding Record API to list domain forwarding records present on your server. The API response contains all details of the domain forwarding records, which are listed according to the ID of the domain forwarding records. To filter or limit the size of the list you can pass in one or more query parameters.

VPS Domain Forwarding feature in Virtualizor allows VPSes to host HTTP/HTTPS services or any other TCP services on a private IP without any need for a public IP. To host an HTTP/HTTPS service, all that is required for a VPS is a valid domain name registered with any Domain Registrar. This domain name must point to any one of the source IPs made available for VPS Domain Forwarding by Virtualizor administrator.

For more information you can refer this Manage VPS Domain Forwarding Guide.

HTTP Request

https://hostname:4085/index.php?act=haproxy&s_id=VDFID&s_serid=SERID&s_vpsid=VPSID&s_protocol=PROTOCOL&s_src_hostname=SRCHOSTNAME&s_src_port=SRCPORT&s_dest_ip=DESTIP&s_dest_port=DESTPORT&haproxysearch=HAPROXYSEARCH

Parameters

NameMethodValueDescriptionRequired
actGEThaproxyThe action specified to carry out operation and return dataYes
pageGETIntIf not specified, then only first 50 records are returnedYes
reslenGETIntNumber of records to be returned, default is 50Yes
haproxysearchPOST1If set the records will be shown as per the search parametersYes
s_idPOSTIntSearch using the vdf IDNo
s_seridPOSTIntSearch using the server IDNo
s_vpsidPOSTIntSearch using the vspidNo
s_protocolPOSTtextSearch using the protocol (TCP, HTTP, HTTPS)No
s_src_hostnamePOSTtextSearch using the source hostnameNo
s_src_portPOSTIntSearch using the source portNo
s_dest_ipPOSTtextSearch using the destination ipNo
s_dest_portPOSTIntSearch using the destination portNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $page = 1;
    $reslen = 5;
    $post = array();
    $post['s_id'] = 7;
    $post['s_serid'] = '';
    $post['s_vpsid'] = '';
    $post['s_src_hostname'] = '';
    $post['s_src_port'] = '';
    $post['s_protocol'] = '';
    $post['s_dest_ip'] = '';
    $post['s_dest_port'] = '';
    $post['haproxysearch'] = 1;

    $output = $admin->listhaproxy($page, $reslen, $post);

    print_r(json_encode($output));
?>

Output

{
    "7": {
        "id": "7",
        "vpsuuid": "tfri5lvqzl8lqhvt",
        "serid": "0",
        "protocol": "TCP",
        "src_hostname": "202.168.147.144",
        "src_port": "1226",
        "dest_ip": "10.0.0.10",
        "dest_port": "22",
        "timeadded": "1535472510",
        "timeupdated": "0",
        "skipped": "",
        "vpsid": "62",
        "vps_name": "v1016",
        "hostname": "www.mydomain.com"
    }
}
Was this helpful to you?