Modify the Web proxy service on ESX 3i to support HTTP
Published by vvirtualize on June 24, 2009Many times we hurdle on how to enable http at ESXi Servers as they are COSless and one need to update the "proxy.xml" to enable HTTP. Here are the easy steps to upload the updated proxy.xml.
Follow the below mentioned steps:
1. Download the proxy.xml from https://<hostname>/host, save a local copy.
Note: Do not rename the file.
2. Use a text editor to open the downloaded proxy.xml file.
3. Navigate to the list of endpoints in the file (identified by the <EndpointList> tag) that contains settings for the Web service supporting the SDK. The nested tags may look something like this:
...
<e id="1">
<_type>vim.ProxyService.NamedPipeServiceSpec</_type>
<accessMode>httpsWithRedirect</accessMode>
<pipeName>/var/run/vmware/proxy-sdk</pipeName>
<serverNamespace>/sdk</serverNamespace>
</e>
...
4. Change the accessMode to httpAndHttps. Alternatively, to completely disable HTTPS, you can set it to httpOnly.
5. Save your settings and close the file.
6. Upload the updated file using httpFileAccess mechanism. Please refer below C# code snippet to upload the file.
Cookie cookie = _service.CookieContainer.GetCookies(new Uri(url))[0];
String cookieString = cookie.ToString();
String httpUrl = "https://" + <hostname> + "/host/proxy.xml";
httpUrl = httpUrl.Replace("\\ ", "%20");
Console.WriteLine("Putting VM File " + httpUrl);
WebClient client = new WebClient();
NetworkCredential nwCred = new NetworkCredential();
nwCred.UserName = username;
nwCred.Password = password;
client.Credentials = nwCred;
client.Headers.Add(HttpRequestHeader.Cookie, cookieString);
client.UploadFile(httpUrl, "PUT", localpath);
Note: You need to first login using VI APIs, steal a cookie from an active session.
7. Restart the hostd management services using DCUI.