Get Virtualizor

Add Domain Forwarding

Use Add Domain Forwarding API to add new domain forwarding on VPS of your server.

HTTP Request

https://hostname:4083/index.php?act=managevdf&svs=VPSID

Parameters

NameTypeValueDescriptionRequired
actGETmanagevdfThe action which will return data belonging to a particular page.Yes
svsPOSTVPSIDProvide vpsid of which you want the information.Yes
vdf_actionPOST textProvide action as "addvdf" to add new domain forwarding.Yes
protocolPOST text Provide protocol for which you want domain forwarding. Yes
src_portPOST text Provide source port which will be used to access site. Yes
src_hostnamePOST text Provide source hostname which will be used to access site. Yes
dest_ipPOST text Provide destination ip on which you want to forward the user. Yes
dest_portPOST text Provide destination port on which you want to forward the user. Yes

Protocols

( HTTP | HTTPS | TCP )

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');
    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'host_ip';

    $v = new Virtualizor_Enduser_API($ip, $key, $pass);
	
	$vid = 6710;//vps id
	$post['svs'] = 6709;
	$post['vdf_action'] = 'addvdf';//action
	$post['protocol'] = 'HTTP';//protocol
	$post['src_port'] = '7222';//source port
	$post['src_hostname'] = 'domain.com';//hostname
	$post['dest_ip'] = 'xx.xx.xx.xx';//destination ip
	$post['dest_port'] = '4084';//destination port
	$vps = $v->vdf($post);
	
    print_r(json_encode($vps));
?>

Curl

curl -k -X POST -d "vdf_action=addvdf&protocol=HTTP&src_port=7222&src_hostname=domain.com&dest_ip=xx.xx.xx.xx&dest_port=4084" -L "https://hostname:4083/index.php?act=managevdf&svs=6709&api=json&apikey=your_api_key&apipass=your_api_pass"

Output

{
   "uid":"600",
   "act":"managevdf",
   "timezone":2,
   "timenow":"July 25, 2019, 11:18 am",
   "vpsid":6709,
   "username":"a@a.com",
   "user_type":"2",
   "preferences":{
      "fname":"",
      "lname":"",
      "theme":"default",
      "language":"english",
      "timezone":2
   },
   "url":"index.php?",
   "rdns":{
      "pdnsid":null
   },
   "support_link":"http:\/\/softaculous.com",
   "enable_eu_iso":1,
   "billing_symbol":"$",
   "enable_registration":0,
   "inhouse_billing":"0",
   "title":"KVMTestServer",
   "haproxydata":{
      "306":{
         "id":"306",
         "vpsuuid":"bf7vd4cdkzx16eiv",
         "serid":"4",
         "protocol":"TCP",
         "src_hostname":"xx.xx.xx.xx",
         "src_port":"7207",
         "dest_ip":"xx.xx.xx.xx",
         "dest_port":"22",
         "timeadded":"1563360672",
         "timeupdated":"0",
         "skipped":"",
         "vpsid":"6709",
         "vps_name":"v3350",
         "hostname":"test_openvz1"
      }
   },
   "supported_protocols":[
      "HTTP",
      "HTTPS",
      "TCP"
   ],
   "vpses":{
      "bf7vd4cdkzx16eiv":{
         "vpsid":"6709",
         "uuid":"bf7vd4cdkzx16eiv",
         "vps_name":"v3350",
         "serid":"4",
         "uid":"600",
         "hostname":"test_openvz1",
         "ips":{
            "xx.xx.xx.xx":{
               "ipid":"384307",
               "ip":"xx.xx.xx.xx",
               "vpsid":"6709"
            }
         }
      }
   },
   "arr_haproxy_src_ips":[
      "xx.xx.xx.xx"
   ],
   "done":{
      "id":"313",
      "msg":"Added successfuly\nNote: For domain forwarding to work, this vps's domain name (domain.com) must point to one of these IPs:\nxx.xx.xx.xx"
   },
   "server_haconfigs":{
      "4":{
         "haproxy_enable":1,
         "haproxy_src_ips":"xx.xx.xx.xx",
         "haproxy_reservedports":"22",
         "haproxy_reservedports_http":"80,443",
         "haproxy_allowedports":""
      }
   },
   "time_taken":"2.330"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list