How to Make Resty Use a SOCKS5 Proxy for Better Connectivity?

18 Replies, 2143 Views

Hey! I had the same issue with resty use socks5 proxy a while back. What worked for me was using the `lua-resty-http` library. You can configure it to use a socks5 proxy by setting the `socks5_proxy` option in the client config.

For auth-enabled proxies, you’ll need to pass the username and password as part of the proxy URL like this: `socks5://user:pass@proxyhost:port`.

Here’s a quick snippet:
```lua
local http = require("resty.http")
local client = http.new()
clientConfusedet_proxy_options({
socks5_proxy = "socks5://user:pass@proxyhost:port"
})
```
Hope this helps! Let me know if you need more details.

Messages In This Thread



Users browsing this thread: 1 Guest(s)