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
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | haproxy | The action specified to carry out operation and return data | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | Yes |
reslen | GET | Int | Number of records to be returned, default is 50 | Yes |
haproxysearch | POST | 1 | If set the records will be shown as per the search parameters | Yes |
s_id | POST | Int | Search using the vdf ID | No |
s_serid | POST | Int | Search using the server ID | No |
s_vpsid | POST | Int | Search using the vspid | No |
s_protocol | POST | text | Search using the protocol (TCP, HTTP, HTTPS) | No |
s_src_hostname | POST | text | Search using the source hostname | No |
s_src_port | POST | Int | Search using the source port | No |
s_dest_ip | POST | text | Search using the destination ip | No |
s_dest_port | POST | Int | Search using the destination port | No |
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($post, $page, $reslen);
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"
}
}