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

18 Replies, 2084 Views

Hey folks!

So, I’ve been trying to figure out how to make resty use socks5 proxy for better connectivity, but I’m kinda stuck. 😅

I’ve got this setup where I need to route my requests through a proxy, and I heard resty can handle it, but the docs are a bit vague (or maybe I’m just bad at reading them lol).

Anyone got a quick example or tips on how to make resty use socks5 proxy? Like, do I need to tweak the client config or something?

Also, does it work well with auth-enabled proxies? Cuz mine needs a username/password.

Thanks in advance! 🙏

(PS: sorry if this has been asked before, I tried searching but couldn’t find anything super clear.)
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.
Yo! I feel you, the docs can be a bit cryptic sometimes. For resty use socks5 proxy, you might wanna check out `lua-socks5`. It’s a lightweight library that integrates well with resty.

If your proxy requires auth, you can pass the credentials directly in the proxy string. Something like `socks5://username:password@proxy_address:port`.

Also, make sure your proxy server is reachable and not blocked by any firewall rules. Good luck!
Hey there! I’ve been using resty with socks5 proxy for a while now, and it’s been pretty solid. You’ll need to tweak the client config to include the proxy details.

If your proxy requires authentication, you can add the username and password in the proxy URL like this: `socks5://user:pass@proxy:port`.

Here’s a quick example:
```lua
local http = require("resty.http")
local client = http.new()
clientConfusedet_proxy("socks5://user:pass@proxy:port")
```
If you’re still stuck, let me know, and I can share more details!
Hmm, I had a similar issue with resty use socks5 proxy. The docs aren’t super clear, but I found that using `lua-resty-socks5` worked like a charm.

For auth-enabled proxies, you’ll need to include the credentials in the proxy URL. Something like `socks5://username:password@proxy:port`.

Also, double-check your proxy settings to make sure everything’s configured correctly. Sometimes it’s the small things that trip you up. Good luck!
Wow, thanks everyone for the quick and detailed responses! I tried the `lua-resty-http` approach with the proxy URL including the username and password, and it worked like a charm.

I was initially worried about the auth part, but it seems to handle it just fine. I’ll definitely check out `lua-resty-socks5` as well for future projects.

One quick follow-up: does anyone know if there’s a way to test if the proxy is actually being used? Like, any tools or logs I can check to confirm?

Thanks again, you guys are awesome! 🙌
Hey! I’ve been down this road before with resty use socks5 proxy. The key is to use the `set_proxy` method in the resty client config.

If your proxy requires auth, you can include the username and password in the proxy URL like this: `socks5://user:pass@proxy:port`.

Here’s a quick example:
```lua
local http = require("resty.http")
local client = http.new()
clientConfusedet_proxy("socks5://user:pass@proxy:port")
```
If you’re still having trouble, let me know, and I can help you debug further.
Yo! I had the same problem with resty use socks5 proxy. I ended up using `lua-resty-socks5` and it worked like a charm.

For auth-enabled proxies, you’ll need to include the credentials in the proxy URL. Something like `socks5://username:password@proxy:port`.

Also, make sure your proxy server is up and running. Sometimes it’s the simplest things that cause the most headaches. Good luck!
Hey! I’ve been using resty with socks5 proxy for a while now, and it’s been pretty solid. You’ll need to tweak the client config to include the proxy details.

If your proxy requires authentication, you can add the username and password in the proxy URL like this: `socks5://user:pass@proxy:port`.

Here’s a quick example:
```lua
local http = require("resty.http")
local client = http.new()
clientConfusedet_proxy("socks5://user:pass@proxy:port")
```
If you’re still stuck, let me know, and I can share more details!
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.



Users browsing this thread: 1 Guest(s)