Expose local HTTP Proxies over Cloudflare Tunnel

Prerequisites

  • Server

    • For running your proxy.

  • Client:

    • For accessing your proxy.

  • Access to Cloudflare Zero Trust:

    • For exposing your proxy to Internet over Cloudflare Infrastructure

      • PS: You will need an domain pointing to Cloudflare's nameservers.

Exit node

You will need run the local proxy on your server.

For this POC, i will be using a segfault.net instance as exit node:

Cloudflare and Server Setup

On Cloudflare Dashboard, just go to the Zero Trust:

Then, Create a tunnel:

Select Cloudflared:

Is required to name your tunnel:

Copy the tunnel's secret (you can install it, i prefer to always keep the things up on my terminal session only):

Paste and run it on your server:

After that, you will see a new connector on Cloudflare Dashboard. Just go ahead with "Next" button:

Then, chose your domain and type your desidered subdomain:

Now, back to your server, start your proxy :

Back to Cloudflare Dashboard, fill with your proxy listener configuration:

Then, click on Complete setup.

Client Setup

On your client, download the Cloudflared binary and run Cloudflare Tunnel Access:

Now, we can check the proxy by curl command with --proxy parameter:

We can use the proxy on browser too:

This instance on segfault.net has 2 exit nodes, as we see on the Exit node:

Well, this is an simple example. You can use this to multiple scenarios. I have some personal notes that i like to share with you:

  • If you are in an controlled environment (your corp, eg.), the network administrator will see that you connected to an Cloudflare's IP, not the exit node

Last updated

Was this helpful?