I try to implement a widget for my Gamin Fenix 7. The task I struggle with is query data from an elastic server (TLS encryption with Lets Encrypt via a Traefik setup).
Query the data to test before with postman works fine:
1. In the simulator without "Use device HTTPS Requirements" everything works.
2. In the simulator with "Use device HTTPS Requirements" it gives a 404 response.
I usually read in other posts, that this is due to self signed certificates. But with postman and with curl I do not get any issue here. Might be unrelated.
3. On the device it gives a 401 response.
INVALID_HTTP_HEADER_FIELDS_IN_NETWORK_RESPONSE | -401 |
API Level 1.0.0 |
Response contained invalid http header fields. |
(from here)
My code looks like this
function onReceive(responseCode, data) { if (responseCode == 200) { System.println("\tRequest Successful\n\tData: " + data); } else { System.println("\tResponse: " + responseCode + "\n\tData: " + data); } } function request() as Void { System.println("Request"); var url = "https://user:[email protected]/_cluster/health?pretty"; var param = {}; var options = { :method => Communications.HTTP_REQUEST_METHOD_GET, :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON , :headers => { "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON } }; Communications.makeWebRequest( url, param, options, method(:onReceive) ); }
Any insights or suggestions here?