You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-23Lines changed: 38 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,23 @@ This proxy implements the 3rd way. Nor admin privileges neither any system-wide
14
14
15
15
A proxy-switching extension for your browser (FoxyProxy or SwitchyOmega e.g.) is highly recommended.
16
16
17
+
## WARNING & DISCLAIMER
18
+
19
+
⚠️ DO NOT RUN this server on a publicly available network interface! This may compromise your network, privacy, wallet, etc. Never run this proxy on `0.0.0.0` if you do not understand what you're doing!
20
+
21
+
Contributors are not responsible for any damage incurred by using this proxy server.
22
+
17
23
## What this proxy does and what's not
18
24
19
-
-:white_check_mark: HTTP proxy protocol is supported
20
-
-:white_check_mark: HTTPS CONNECT method is supported
21
-
-:green_square: SOCKS5 support is expected
22
-
-:green_square: HTTP proxy-chaining support is expected
23
-
-:x: Config file support is possible but not planned
24
-
-:x: Daemon mode support is possible but not planned
25
-
-:x: HTTPS MitM support is not planned (use mitmproxy)
26
-
-:x: Request/response rewrite support not planned (use mitmproxy)
27
-
-:x: ACL support is not planned
25
+
-✅ HTTP proxy protocol is supported
26
+
-✅ HTTPS CONNECT method is supported
27
+
-✅ SOCKS5 protocol is supported
28
+
-✅ HTTP proxy-chaining is supported (use `HTTP_PROXY` environment variable)
29
+
-❌ Config file support is possible but not planned
30
+
-❌ Daemon mode support is possible but not planned
31
+
-❌ HTTPS MitM support is not planned (use mitmproxy)
32
+
-❌ Request/response rewrite support is not planned (use mitmproxy)
33
+
-❌ ACL support is not planned
28
34
29
35
## Usage
30
36
@@ -34,46 +40,55 @@ Run the HTTP proxy on 127.0.0.1:8080 and redirect some hostnames to a local web
34
40
etc-hosts-proxy run -H example.com=127.0.0.1 -H www.example.com=127.0.0.1
35
41
```
36
42
37
-
Note: you may use comma-separated list of `<host>=<ip>` pairs in a single `-H` option too: `-H example.com=127.0.0.1,www.example.com=127.0.0.1`
38
-
39
43
Test the above with curl:
40
44
41
45
```bash
42
46
curl -v -x 127.0.0.1:8080 http://example.com
43
47
curl -v -x 127.0.0.1:8080 http://www.example.com
44
48
```
45
49
46
-
Proxy listens on `127.0.0.1:8080` by default. Use `-L` (or `--listen-address`) CLI option to change this.
50
+
NOTE: Proxy listens on `127.0.0.1:8080` by default. Use `-L` (or `--listen-address`) CLI option to change this.
51
+
52
+
Run the SOCKS5 proxy on 127.0.0.1:1080 and redirect some hostnames to a local web server:
53
+
54
+
```bash
55
+
etc-hosts-proxy run -M socks5 -L 127.0.0.1:1080 -H example.com=127.0.0.1,www.example.com=127.0.0.1
NOTE: You should not use 127.0.0.1 (or ::1) as your redirection target in the hosts list while running in a container. This will redirect the request to the container's localhost, which is not what you might expect.
79
+
NOTE: You should not use 127.0.0.1 (or ::1) as your redirection destination in the hosts list while running in a container. This will redirect the request to the container's localhost, which is not what you might expect. You can use `host` Docker network if you really need it.
65
80
66
81
A bit more complex example to redirect some domains to a nginx container:
67
82
68
83
```bash
69
84
# Create a docker network
70
85
docker network create somenet
71
86
72
-
# Run a web server exposed in somenet and on 0.0.0.0:8080 on the host
73
-
docker run -d --name=nginx --net=somenet -p 8080:80 --rm nginx:latest
87
+
# Run a web server exposed in somenet and on 127.0.0.1:8080 on the host
88
+
docker run -d --name=nginx --net=somenet -p 127.0.0.1:8080:80 --rm nginx:latest
74
89
75
-
# Run the proxy connected to somenet and exposed on 0.0.0.0:3128 on the host
76
-
docker run -d --name=etc-hosts-proxy --net=somenet -p 3128:8080 --rm \
90
+
# Run the proxy connected to somenet and exposed on 127.0.0.1:3128 on the host
91
+
docker run -d --name=etc-hosts-proxy --net=somenet -p 127.0.0.1:3128:8080 --rm \
0 commit comments