Simple HTTP proxy

I’m just playing with a simple HTTP proxy app, namely this image: Docker Hub

And fly.toml is:

app = "fly-proxy"

[[services]]
  internal_port = 8888
  protocol = "tcp"

  [[services.ports]]
    handlers = ["http"]
    port = 10080

So the strange thing is that when I proxy a non SSL site, it works fine, but when I proxy a HTTPS site, Tinyproxy never gets to see the domain, only the :443 portion, which it complains as not being a resolvable domain. It’s almost like Fly is rewriting the domain? This is the command I use:

curl -vvv -x 'fly-proxy.fly.dev:10080' 'https://jsonip.com'

Our http handler will alter headers, which might not be what you want for an HTTP proxy. You might try removing the handler to see if it works like you’d expect:

app = "fly-proxy"

[[services]]
  internal_port = 8888
  protocol = "tcp"

  [[services.ports]]
    handlers = []
    port = 10080

Thanks for the quick response. I tried that and the request didn’t even seem to go through.

Here’s the actual logs from the handler is http:

2021-09-22T02:01:27.494468013Z app[0d576593] atl [info] CONNECT   Sep 22 02:01:27.493 [509]: Connect (file descriptor 12): 86.109.8.85
2021-09-22T02:01:27.494499100Z app[0d576593] atl [info] CONNECT   Sep 22 02:01:27.494 [509]: Request (file descriptor 12): GET / HTTP/1.1
2021-09-22T02:01:27.494700499Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.494 [509]: process_request: trans Host GET http://jsonip.com:80/ for 12
2021-09-22T02:01:27.494719629Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.494 [509]: No upstream proxy for jsonip.com
2021-09-22T02:01:27.494840983Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.494 [509]: opensock: opening connection to jsonip.com:80
2021-09-22T02:01:27.502314988Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.501 [509]: opensock: getaddrinfo returned for jsonip.com:80
2021-09-22T02:01:27.557355962Z app[0d576593] atl [info] CONNECT   Sep 22 02:01:27.556 [509]: Established connection to host "jsonip.com" using file descriptor 13.
2021-09-22T02:01:27.667638900Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.666 [509]: Closed connection between local client (fd:12) and remote client (fd:13)
2021-09-22T02:01:27.943700420Z app[0d576593] atl [info] CONNECT   Sep 22 02:01:27.943 [509]: Connect (file descriptor 12): 86.109.8.85
2021-09-22T02:01:27.943718023Z app[0d576593] atl [info] CONNECT   Sep 22 02:01:27.943 [509]: Request (file descriptor 12): CONNECT / HTTP/1.1
2021-09-22T02:01:27.943744029Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.943 [509]: No upstream proxy for
2021-09-22T02:01:27.943750781Z app[0d576593] atl [info] INFO      Sep 22 02:01:27.943 [509]: opensock: opening connection to :443
2021-09-22T02:01:27.943794669Z app[0d576593] atl [info] ERROR     Sep 22 02:01:27.943 [509]: opensock: Could not retrieve address info for :443: Name does not resolve