Skip to content

Proxy don't work when switch target URL to object #1651

Open
@ehatari

Description

@ehatari

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 ?

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