'How to investigate a proxy returning 400
I have this java code:
u = new URL(url);
c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setRequestProperty("Accept", "application/json");
c.setConnectTimeout(15000);
c.setReadTimeout(15000);
c.setInstanceFollowRedirects(false);
if (url.startsWith("https://")) {
((javax.net.ssl.HttpsURLConnection) c).setHostnameVerifier(SSLCertTruster.DO_NOT_VERIFY);
}
I am accessing the URL https://hl7.org/fhir/us/core/package-list.json. On all but a few computers, this works fine. But on some computers (one windows, one mac), this code fails and the URL can't be accessed. In this case, the result of the HTTP call is HTTP 400 Bad Request with this body:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>
I assume this is a proxy... but I can't debug since it's not happening for me. I'm not sure what to look for?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
