ApplicationInsights-node.js icon indicating copy to clipboard operation
ApplicationInsights-node.js copied to clipboard

No events in the dashboard when using proxy, 'Document Moved' messages in the log

Open petersendev opened this issue 6 years ago • 2 comments

I am having trouble using the SDK behind a proxy (in a docker container).

If using a proxy url like http://proxyfqdn:3128 in appInsights.defaultClient.config.proxyHttpUrl and appInsights.defaultClient.config.proxyHttpsUrl I am receiving the following log entries (after activating internal logging):

ApplicationInsights:CorrelationIdManager [ { method: 'GET', disableAppInsightsAutoCollection: true } ]
ApplicationInsights:Sender [ { method: 'POST',
    withCredentials: false,
    headers:
     { 'Content-Type': 'application/x-json-stream',
       'Content-Encoding': 'gzip',
       'Content-Length': 635 } } ]
ApplicationInsights:Sender [ '<head><title>Document Moved</title></head>\n<body><h1>Object Moved</h1>This document may be found <a HREF="https://dc.services.visualstudio.com/v2/track">here</a></body>' ]

As I understand it, there was once a change from http to https (see https://github.com/Microsoft/ApplicationInsights-node.js/issues/196#issuecomment-284798465), but even explicitly setting

appInsights.defaultClient.config.endpointUrl = "https://dc.services.visualstudio.com/v2/track";

makes no difference.

I would appreciate any advice how to solve this. I have to use a proxy and can't use http(s)_proxy environment variables because of other libraries breaking for internal calls (since they don't support no_proxy).

petersendev avatar Dec 12 '18 13:12 petersendev

@petersendev Does your proxy support https requests in general? What happens if you try a test request using your proxy to a server that only responds on HTTPS, such as https://tls-v1-2.badssl.com:1012/

From a first glance, it seems that the actual protocol (http vs https) is getting lost, either between this SDK and your proxy, or your proxy and the outer internet.

OsvaldoRosado avatar Jan 30 '19 01:01 OsvaldoRosado

HTTPS traffic works fine, albeit not via custom port.

petersendev avatar Jan 30 '19 09:01 petersendev