Enabling web-domain-proxy
Enabling web-domain-proxy
I'm trying to add a web domain proxy via the api.
It works fine using the command line:
but when I try this through the API I get an error:
Error: argument extentions is not valid (empty)
It works fine using the command line:
Code: Select all
v-add-web-domain-proxy ted test.test.com
Error: argument extentions is not valid (empty)
Code: Select all
function createWebDomainProxy($server,$admuser,$admpa,$proxyDomain)
{
// Prepare variables
$postvars1 = array(
'user' => $admuser,
'password' => $admpa,
'cmd' => 'v-add-web-domain-proxy',
'arg1' => 'ted',
'arg2' => $proxyDomain
);
$postdata = http_build_query($postvars1);
//echo $postdata;
// Get current status
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $server . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
return $answer;
}
$server = '192.0.0.0';
$admuser = 'admin';
$admpa = 'topsecret';
$domain = 'test.test.com'
echo createWebDomainProxy($server,$admuser,$admpa,$domain);
Re: Enabling web-domain-proxy
It doesn't appear to like commas in the extensions argument via the api, even the default ones in the v-add-web-domain-proxy script (when I don't pass extensions in the api).
If I change my script to add arg3 and arg4, it only runs if arg4 contains a single extension.
This works:
This doesn't:
If I change my script to add arg3 and arg4, it only runs if arg4 contains a single extension.
This works:
Code: Select all
'arg4' => 'htm'
Code: Select all
'arg4' => 'jpg, htm'
Re: Enabling web-domain-proxy
This does:
Is there a requirement with the api that all arguments need to be provided (even if blank)?
It looks like arg4 in v-add-web-domain-proxy doesn't like comma space
htm, jpeg, jpg = BAD
htm,jpeg,jpg = GOOD
Code: Select all
'arg4' => 'jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm',//DEBUG ME
It looks like arg4 in v-add-web-domain-proxy doesn't like comma space
htm, jpeg, jpg = BAD
htm,jpeg,jpg = GOOD
Re: Enabling web-domain-proxy
Well you already figured out how it works :) Extension list should be always defined and spaces are not allowed
Re: Enabling web-domain-proxy
I'm getting there skid (slowly). :)skid wrote:Well you already figured out how it works :) Extension list should be always defined and spaces are not allowed
The default extension list (that's used when none are specified) does contain spaces though, this causes the script to error.
Re: Enabling web-domain-proxy
I see. The web interface have some basic validation logic and it chops spaces and carriage returns prior sending.