aws/aws-xray-sdk-node

Bug in generation of the http.url

ocdinvstr opened this issue · 3 comments

Line below in the "aws-xray-sdk-core/dist/lib/middleware/incoming_request_data.js" is generating url wrong. When concatenating the req.host and req.url it's eating up the backslash between host and url and generating url as "https://xyz.domain.comapicall" instead of "https://xyz.domain.com/apicall" and all the service endpoints are being stored and displayed wrong on X-Ray side.

        url = ((req.connection.secure || req.connection.encrypted) ? 'https://' : 'http://') +
            ((req.headers['host'] || '') + (req.url || ''));

According to the Node documentation, req.url should generally begin with a slash. Do you have a reproduction case where this malformed URL is being produced?

Right, in the case, some custom library added to Restify as plugin is removing it.

Thanks for the help @willarmiros, it's my mistake not to look at other codes in the project first, but if you consider this for the next releases, even it's done by other code library, it would be good.