Arnold_Zokas_13
Nov 22, 2013Nimbostratus
iControl API request fails with HTTP-400 error. How do I diagnose the cause of failure?
I am writing a PowerShell script to query the status of a pool in our F5 load balancer:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://{0}/iControl/iControlPortal.cgi" -f "xxx.xxx.xxx.xxx")
$request.Method = "POST"
$request.Credentials = new-object System.Net.NetworkCredential @("*********", "*********")
$request.Proxy = new-object System.Net.WebProxy @("xxx.xxx.xxx.xxx", xxxx)
$payload = '{0}' -f "pool-1"
$requestPayloadWriter = new-object System.IO.StreamWriter $request.GetRequestStream()
$requestPayloadWriter.Write($payload)
$requestPayloadWriter.Close()
$request.GetResponse()
$responsePayloadReader = new-object System.IO.StreamReader $request.GetResponse().GetResponseStream()
$pool_status = $responsePayloadReader.ReadToEnd()
$responsePayloadReader.Close()
This works successfully when I run it on my machine, but fails with HTTP-400 error when I run it from our TeamCity build agent. The only difference I am aware of is TeamCity agent has to go through a Squid proxy - my machine does not.
I have verified F5 management console IP address is in the proxy whitelist. My suspicion is the proxy modifies request headers/payload somehow, but I don't know how to verify this.
Is there a log I can view via the Management Console that would give me diagnostic info on attempted API requests?