0

Code running fine for http URL but showing error when URL changes to HTTPS ERROR: 504(GATEWAY_TIMEOUT)

        List<TableauSite> SitesList = new List<TableauSite>();
        string url = server + "/api/" + TableauServerVersion.version + "/sites";
        HttpWebRequest wc = WebRequest.Create(url) as HttpWebRequest;
        wc.Method = "GET";
        wc.Headers.Add("x-tableau-auth", signedInObj.ACCESS_TOKEN);
        try
        {
            HttpWebResponse wr = wc.GetResponse() as HttpWebResponse;
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(wr.GetResponseStream());
            SitesList = helperFunction(serverinfo, xmldoc, server,signedInObj);
            return SitesList;
        }
        catch (WebException we)
        {
            //Catch failed request and return the response code
            response = ((HttpWebResponse)we.Response).StatusCode.ToString();
            ErrorHandling.getException(we);
        }
        return null;
    }
Saad
  • 39
  • 1
  • 4
  • Looks like the server you are connecting to requires HTTPS (Secure) and you are only send non secure. – jdweng Aug 22 '19 at 12:05
  • Server is secure – Saad Aug 22 '19 at 12:34
  • Your request is missing required headers. Can you connect with an Browser manually? If you can use a sniffer like wireshark or fiddler and capture the browser first request and compare the header in request with your non work request. – jdweng Aug 22 '19 at 12:36
  • No i cannot connect browser manually, it is at client side... didn't have access – Saad Aug 22 '19 at 12:49
  • The https is using TLS for security. HTTP uses TCP as the transport layer. So a TLS connection is established using TCP as part of going secure. See following : https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest?view=netframework-4.8 – jdweng Aug 22 '19 at 13:31

0 Answers0