microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
320 stars 138 forks source link

Support HTTPS proxy #783

Open JasonYeMSFT opened 3 years ago

JasonYeMSFT commented 3 years ago

Two things I noticed with proxy:

  1. The package seems to only use http proxy url when the endpoint is using http protocol (or https proxy url + https endpoint). This doesn't cover all the scenarios. For example, I can see people using http proxy servers to access https endpoints.
  2. Is there a plan to support https proxy? We have lots of our users using https proxy so we would like to collect telemetry data from them as well.
emmansun commented 2 years ago

This package supports proxy with http proxy url, your ingestionEndpoint normally will be https endpoint, and it uses "HTTP tunneling without using CONNECT" method, please refer https://en.wikipedia.org/wiki/HTTP_tunnel for detail. Yes, I also agree this proxy method is NOT a good method, it's not safe enough. below are squid log sample:

image

If the proxy implementation method is "HTTP CONNECT method", you will see "TCP_TUNNEL" in the log.

For implementation detail, please refer https://github.com/microsoft/ApplicationInsights-node.js/blob/develop/Library/Util.ts makeRequest https://github.com/microsoft/ApplicationInsights-node.js/blob/master/Library/Config.ts

JacksonWeber commented 2 months ago

@JasonYeMSFT We've recently upgraded to using OpenTelemetry under the hood of this SDK. Could you test this issue out again, as it should be resolved. Thank you.