http-party/node-http-proxy

Proxy don't work when switch target URL to object

ehatari opened this issue · 0 comments

Hi, i have some problem with proxy. I try run https -> http proxy.
If i make this code:

var proxy = httpProxy.createProxyServer({
  target: "https://127.0.0.1:443",
  secure:false
})

This work. I try it to convert object but don't work. This is my code:

const proxy = httpProxy.createProxyServer({
  target:{
    host: '127.0.0.1',
    protocol: 'https',
    port: 443
  },
  secure:false
})

I get error:
Error: connect ECONNREFUSED 127.0.0.1:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 443
}

How I convert Target url like string to object ?