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

Proxy is not working if port is specified

Open ghost opened this issue 5 years ago • 2 comments

If port is specified, getting the following error 2019-9-16 16:44:27 - error Socket Closed on proxy 127.0.0.1:4321

It seems that if port is specified, it gets into the parsed hostname which cannot be resolved by dns. The problem is because url.parse returns host WITH the port. The solution is to simply use hostname field

> ph = url.parse(`http://google.com:2222`);
Url {
  protocol: 'http:',
  slashes: true,
  auth: null,
  host: 'google.com:2222',
  port: '2222',
  hostname: 'google.com',
  hash: null,
  search: null,
  query: null,
  pathname: '/',
  path: '/',
  href: 'http://google.com:2222/' }
>

ghost avatar Sep 16 '19 14:09 ghost

@erivni

ghost avatar Sep 16 '19 14:09 ghost

PR can be closed, re-opened https://github.com/oyyd/http-proxy-to-socks/pull/10 under proper account

shlompy avatar Sep 16 '19 14:09 shlompy