getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

HTTP2 requests having no host header goes to localhost/127.0.0.1 #4308

Closed usamaejaz closed 2 years ago

usamaejaz commented 2 years ago

Package + Version

Version:

^4.1.1

Description

Sentry patches HTTP modules for request tracking. In doing so, it builds URL from host header: https://github.com/getsentry/sentry-javascript/blob/master/packages/node/src/integrations/utils/http.ts#L28

On the other hand, a private library we use removes host and connection from request headers in the case of http2. The http2 request is made by got module (I assume it uses the modules that sentry patches).

So, sentry constructs request url from host or hostname and it ends up building urls like: http://:80 or http://:443 which go to localhost.

This was very hard to track down and Sentry (gave us a lot of trouble and buggy behavior - ironic, we do love sentry though).

usamaejaz commented 2 years ago

Any update? Just because of this, I am not able to use Sentry fully in our node server.

Lms24 commented 2 years ago

Hi @usamaejaz, have you tried updating to the newest version of @sentry/node? v4 is quite old already, as the newest version currently (at the time of writing this) is v6.19.6 and we're actively working on v7.