3

How can I allow a program, which only supports talking through a HTTP proxy, to talk through a SOCKS proxy? In other words, take the HTTP-proxy request and turn it into a SOCKS-proxy request which gets forwarded to the SOCKS proxy, and pass the returned data back to the program through the HTTP proxy.

I need a solution that works on Debian Linux, preferably using software that is prepackaged in Debian's main repository.

The chain of communications would be: My program -> HTTP proxy (local) -> SOCKS proxy (local) -> External access

I found a handful of questions about doing it the other way around (a SOCKS proxy forwarding to a HTTP proxy), but that doesn't help me. HTTP proxy server for Windows that forwards to SOCKS proxy is similar to what I want, but since it asks for Windows solutions it doesn't help me.

user
  • 29,449
  • 11
  • 99
  • 144
  • You can use `TorSocks` for this. It's a preloadable library that redirects programs to use a socks proxy. It's typically used to redirect to Tor, but it can redirect to anything. – David Schwartz Nov 23 '15 at 12:21
  • @DavidSchwartz Interesting! It doesn't exactly match the question title, but it does seem to allow me to do what I want to be able to (have the original application talk through a SOCKS proxy). Would you be willing to post that as an answer? – user Nov 23 '15 at 13:09
  • `DeleGate` is not just for Windows, it exists for all OSes, just look here, ftp://delegate.hpcc.jp/pub/DeleGate/bin/linux/9.9.13/ – MariusMatutiae Nov 23 '15 at 15:14
  • [`forward-socks5`](https://www.privoxy.org/user-manual/config.html#SOCKS) of `Privoxy` can also achieve this. – Weekend Nov 13 '21 at 21:34

2 Answers2

1

You can use TorSocks for this. It's a preloadable library that redirects programs to use a socks proxy. It's typically used to redirect to Tor, but it can redirect to anything.

David Schwartz
  • 61,528
  • 7
  • 100
  • 149
  • `tsocks` IIRC is the program `torsocks` uses or is based on, and can be configured to redirect to anything you want. – LawrenceC Nov 23 '15 at 15:47
0

v2ray and https://github.com/oyyd/http-proxy-to-socks both can do this.

An example of using the latter:

npm install -g http-proxy-to-socks

Exposes the socks proxy on port 1078 as an HTTP proxy on port 1088:

hpts --level info -s 127.0.0.1:1078 -p 1088
HappyFace
  • 1,108
  • 2
  • 12
  • 17