mholt/caddy-l4

Fowarding to target website via a socks5 proxy.

Open

#114 opened on Apr 6, 2023

 (2 comments) (0 reactions) (0 assignees)Go (114 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (1,738 stars)
PR merge metrics
 (Avg merge 14d 19h) (7 merged PRs in 30d)

Description

I found this extension module through google https://caddy.community/t/fowarding-to-target-website-via-a-socks5-proxy/12349

I have the same requirement as the source, when I visit http://abc.com, it can send me through a specific socks5 proxy (like socks5://127.0.0.1:40000 of cf warp or shadowsocks/v2ray) Redirect to the target website, such as: https://xxx.com

I try to learn the configuration of this module, but I have no clue at all. The display in the readme is relatively simple. I can't understand what configuration I need to do. Can you help me?

My original configuration looks like this:

{
    "apps": {
        "http": {
            "servers": {
                "srv0": {
                    "listen": [":443"],
                    "routes": [{
                        "match": [{ "host": ["abc.com"] }],
                        "handle": [{
                            "handler": "subroute",
                            "routes": [{
                                "handle": [{
                                    "handler": "reverse_proxy",
                                    "headers": { "request": { "set": { "Host": ["{http.reverse_proxy.upstream.hostport}"] } } },
                                    "upstreams": [{ "dial": "xxx.com:80" }]
                                }]
                            }]
                        }],
                        "terminal": true
                    }]
                }
            }
        }
    }
}

Contributor guide