szydan
szydan

Reputation: 2596

How to enable/configure SOCKS proxy support in apache mod_proxy ( Apache2 )

I'm trying to find a documentation about how to setup apache2 mod_proxy with SOCKS proxy I've found this page http://menet.math.ecnu.edu.cn/manual/mod/mod_proxy.html#socks But it is about apache version 1, and I'm not sure that the recipe there still apply to version 2

What I'm trying to achieve is:

Have an apache2 serving my domain exampleA.com, and SOCKS proxy. They are both running on server A. SOCKS proxy is there so some apps on server A can communicate with other apps on servers B,C and it is running on localhost:4000

What I want is when user visit a specific url like http://exempleA.com/spetialurl/http://exampleB.com/xxx

this http request will be proxied via apache mod_proxy to server B - but through SOCKS proxy or if user access http://exempleA.com/spetialurl/http://exampleC.com/xxx this will be proxied to server C also through mod_proxy via SOCKS proxy

I can configure the mod_proxy to proxy a specyfic url to servers B or C What I'm missing is how to configure/tell apache2 to use the SOCKS proxy

This urls on servers B and C are not publicly visible, but they can be accessed through SOCKS proxy

Upvotes: 14

Views: 6202

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146530

Unfortunately you can't use it directly. The closest thing that is there is below directive

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote

And for me below config works great for an http proxy but not for an socks proxy

ProxyPass / http://ipinfo.io/
ProxyPassReverse / http://ipinfo.io/
ProxyRequests On
RequestHeader set Host "ipinfo.io"
ProxyRemote http http://185.93.3.123:8080

The result is below

IP Proxy Apache

Which shows that request is proxied correctly through the proxy. But doing it with a socks proxy results in 502 and I couldn't find a documentation saying socks5 is supported

So your option is to use something like polipo

https://www.irif.fr/~jch/software/polipo/

You can use it as a http->socks proxy forwarder and then ProxyRemote to the local polipo port

Upvotes: 3

Related Questions