Skip to content

Type error in url parsing when using rewrite options and target option is an object #1338

@tverilytt

Description

@tverilytt

Hi!

I ran into the error below when trying to use protocolRewrite (or hostRewrite).

I think the reason is I have configured the proxy options "target" as an object, e.g.
target: {
host: 'www.example.com',
port: 443,
protocol: 'https:'
}

I assume that, if the options.target property is an object, the URL string version could be built from the options.target object properties...

Cheers
-jo


TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type object
at Url.parse (url.js:154:11)
at Object.urlParse [as parse] (url.js:148:13)
at Array.setRedirectHostRewrite (/Users/jo/Timegrip/gitkraken/europris-proxy/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js:54:24)
at ClientRequest. (/Users/jo/Timegrip/gitkraken/europris-proxy/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:175:22)
at ClientRequest.emit (events.js:189:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at TLSSocket.socketOnData (_http_client.js:442:20)
at TLSSocket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)

https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy/passes/web-outgoing.js

54 var target = url.parse(options.target);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions