Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

socks5 proxy/tunnel for nginx upstream?

are there any solution/patch that would make nginx work with a socks upstream?

something like this:

server {
  location / {
    proxy_pass  socks5://ip:port/
  }
}
like image 372
est Avatar asked Aug 25 '11 03:08

est


2 Answers

I've recently wrote a module doing exactly what you need. You might need something like HAProxy before nginx to support TLS tunneling.

like image 159
dannote Avatar answered Oct 22 '22 14:10

dannote


SOCKS is layer 5, HTTP is layer 7. An HTTP proxy cannot deal with SOCKS, although an HTTP proxy can work over SOCKS. It's unclear to me what you would expect Nginx to do with the response were it able to connect to the SOCKS server. It's similar to asking if Nginx could connect to NetBIOS or PTPP.

Assuming you are attempting to have Nginx proxy to another HTTP server that can only be reached via SOCKS, you need to set this up as part of your network stack on your operating system.

Maybe this link can help you:

http://www.catonmat.net/blog/linux-socks5-proxy/

like image 22
cliff.wells Avatar answered Oct 22 '22 15:10

cliff.wells