node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Proxy don't work when switch target URL to object

Open ehatari opened this issue 2 years ago • 0 comments
trafficstars

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 ?

ehatari avatar Nov 13 '23 17:11 ehatari