大网数据广告活动
服务器运维问答

Connect to upstream/backend via socks5 proxy in NginX/HAProxy

· 52CE 我爱测

I'm trying to make NginX or HAProxy use proxies while connecting to upstream URLs, something like this: Browser -> Nginx/HAProxy -- SOCKS5 Tunnel --> Remote I wonder if it's possible? Edited: Basically I would like to transparent…

问题原文

原帖链接 · skies457 · CC BY-SA 3.0

I'm trying to make NginX or HAProxy use proxies while connecting to upstream URLs, something like this:

Browser -> Nginx/HAProxy -- SOCKS5 Tunnel --> Remote

I wonder if it's possible?

Edited:

Basically I would like to transparently proxy http requests:

  1. Set up a local DNS resolver (e.g. unbound) and rewrite DNS entries pointing some domains to localhost;

  2. NginX/HAProxy handles http requests based on their Host field (I'm also running a HTTP server) and proxies HTTP requests accordingly.

It would be quite useful to provide access to blocked domains without too many configurations on client side (especially in a Docker container, it would be rather difficult if it's an official image).

已采纳解答

原帖链接 · skies457 · CC BY-SA 3.0

End up with a pure port forwarding solution instead of HAProxy or NginX. If anyone happens to come across the same usage scenario, here are some scripts I've been using to proxy domains inside Docker: https://github.com/w1ndy/docker-proxy-domain. Hope it helps!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。