Skip to content

Instantly share code, notes, and snippets.

@sabretus
Last active August 1, 2022 14:48
Show Gist options
  • Save sabretus/167fd1e5a67d9539816ddbb5a9af48c8 to your computer and use it in GitHub Desktop.
Save sabretus/167fd1e5a67d9539816ddbb5a9af48c8 to your computer and use it in GitHub Desktop.
Demo test of egress-proxy in Linux
$ docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED             STATUS             PORTS     NAMES
a1b7657f335d   quiq/egress-proxy:1.21.4.1-alpine          "/opt/openresty/bin/…"   About an hour ago   Up About an hour             egress-proxy
$
$ export http_proxy=127.0.0.1:3128 https_proxy=127.0.0.1:3128
$
$ curl -v ifconfig.me
* Uses proxy env variable http_proxy == '127.0.0.1:3128'
* Trying 127.0.0.1:3128…
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3128 (#0)
> GET http://ifconfig.me/ HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.68.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: openresty/1.21.4.1
< Date: Mon, 01 Aug 2022 13:46:51 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 12
< Connection: keep-alive
< access-control-allow-origin: *
< x-envoy-upstream-service-time: 1
< strict-transport-security: max-age=2592000; includeSubDomains
< Via: 1.1 google
<
* Connection #0 to host 127.0.0.1 left intact
52.34.105.18
$
$
$ curl -v https://ifconfig.me
* Uses proxy env variable https_proxy == '127.0.0.1:3128'
* Trying 127.0.0.1:3128…
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3128 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to ifconfig.me:443
> CONNECT ifconfig.me:443 HTTP/1.1
> Host: ifconfig.me:443
> User-Agent: curl/7.68.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection Established
< Proxy-agent: nginx
<
* Proxy replied 200 to CONNECT request
* CONNECT phase completed!
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CONNECT phase completed!
* CONNECT phase completed!* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x5569fac438c0)
> GET / HTTP/2
> Host: ifconfig.me
> user-agent: curl/7.68.0
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
< access-control-allow-origin: *
< content-type: text/plain; charset=utf-8
< content-length: 12
< date: Mon, 01 Aug 2022 13:48:09 GMT
< x-envoy-upstream-service-time: 1
< strict-transport-security: max-age=2592000; includeSubDomains
< server: istio-envoy
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3–29=":443"; ma=2592000
<
* Connection #0 to host 127.0.0.1 left intact
52.34.105.18
$
$
$ docker logs -f egress-proxy
127.0.0.1 ifconfig.me [2022–08–01T13:46:51+00:00] 0.158 "GET http://ifconfig.me/ HTTP/1.1" 200 12 "-" "curl/7.68.0" -
127.0.0.1 ifconfig.me [2022–08–01T13:48:09+00:00] 0.092 "CONNECT ifconfig.me:443 HTTP/1.1" 200 5726 "-" "curl/7.68.0" -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment