Skip to content

Type a word or two, like firewall or rollback.

Open Coresmith
Browse the docs
Servers Checked against Coresmith 0.8.46.

Take IPv4 visitors through Cloudflare

Open as Markdown

Many home internet providers share one IPv4 address between customers, and many routers don't forward ports 80 and 443. Either way, people can't reach a server at home over IPv4. Visitors with IPv6 may still get through, but plenty of networks don't have it.

Self-hosted Coresmith can bring those visitors in through a Cloudflare Tunnel. The server connects out to Cloudflare, Cloudflare answers visitors over IPv4 and IPv6, and nothing has to be opened on your router.

If another of your servers is reachable over IPv4, it can take the visitors in instead, without Cloudflare or its limits on uploads and slow pages. Take IPv4 visitors through another server.

When Coresmith offers it

Coresmith checks each server's IPv4 address from outside your network. When ports 80 and 443 don't answer there, the server's Apps tab says visitors without IPv6 can't open its apps, and its Network tab shows an IPv4 through Cloudflare card marked IPv4 closed.

Before you start

  • Your domains' DNS is on Cloudflare. The free plan works.
  • The tunnel needs a Cloudflare API token with two permissions: Account, Cloudflare Tunnel, Edit, and Zone, DNS, Edit for the zones your domains are in. The steps below open Cloudflare's token form with both filled in. Coresmith accepts account tokens as well as user tokens.
  • No redirect rules or page rules in those zones send your domains somewhere else. Cloudflare applies them to everything that comes through the tunnel.
  • To bring Coresmith's own address through the tunnel too, add the machine Coresmith runs on as a server first. Add this machine.

Owners can turn the tunnel on and off.

Turn it on

  1. Open the server's Network tab.
  2. On the IPv4 through Cloudflare card, choose Turn on.
  3. Choose Create one in Cloudflare. Cloudflare opens its token form with both permissions filled in. Create the token and copy it.
  4. Paste the token, then choose Turn on.

The card reads Setting up for a minute or two while Coresmith makes the tunnel, installs Cloudflare's connector on the server and points your domains at it. Then it reads On and counts the domains that come through the tunnel. Show the domains lists them.

Coresmith keeps the token encrypted. If you connected Cloudflare earlier for Coresmith's address in Settings, Coresmith uses that token and doesn't ask again, so add the tunnel permission to it in Cloudflare first.

Once the tunnel carries Coresmith's own address, the Address card in Settings, General says the tunnel keeps it, and stops warning that the address has only IPv6.

What changes in your DNS

Coresmith's own address on this machine and every domain of the apps on the server go through the tunnel. For each one, Coresmith replaces the records that point at the server with a single record for the tunnel, with Cloudflare's proxy on. A domain with no records yet gets that record too.

Coresmith leaves a domain alone when its records point somewhere else, when it already answers from a service you set up in Cloudflare, or when the token can't see its zone. The card lists those domains under Left as they were, each with the reason, and the note under the app's domains card gives the same reason. A wildcard record such as *.example.com doesn't count as pointing somewhere else. Coresmith adds the tunnel's record for the app's own name, and the wildcard keeps answering for every other name.

Domains Cloudflare sends elsewhere

Each time it checks the tunnel, Coresmith opens every domain on it through Cloudflare. If Cloudflare redirects a domain to another site before visitors reach the server, the card names the domain and the site it goes to, and leaves it out of its count.

A redirect rule in your Cloudflare account usually causes this. Cloudflare applies its rules to every domain that comes through the tunnel. If the redirect isn't on purpose, delete it in Cloudflare under Redirect Rules, Page Rules or Bulk Redirects, then choose Check again on the card.

A www name that Coresmith answers for joins only when it already points at the server.

Domains you add to apps on the server later join the tunnel on their own, and Add domain shows the tunnel's record instead of the server's addresses. Coresmith checks the tunnel every hour, and Check again on the card checks it now. When a domain joins, Coresmith checks it again and asks for its certificate if it doesn't have one yet.

Move Coresmith to a new domain

While the tunnel is on, Coresmith's own address can move to a domain in the same Cloudflare account:

  1. In Settings, General, choose Change on the Address card and enter the domain.
  2. Choose Check, then Point it here with Cloudflare. Coresmith adds the domain to the tunnel.
  3. Choose Check again, then Switch address.

The old address keeps sending people to the new one.

Replace the token

While a tunnel uses Coresmith's Cloudflare token, Settings won't disconnect it. To swap in a new one:

  1. In Settings, General, choose Replace token on the Address card.
  2. Choose Create one in Cloudflare to open Cloudflare's token form with both permissions filled in, and create the token.
  3. Paste the new token, then choose Replace token.

Coresmith checks that the new token can still manage the tunnel before it replaces the old one. To disconnect Cloudflare, turn the tunnel off first.

Turn it off

Choose Turn off on the card, then Turn off again to confirm. Coresmith points each domain back at the server's own addresses and removes the tunnel and its connector. After that, visitors without IPv6 can't reach the apps unless the server's IPv4 address answers.

If it doesn't finish

The card says what stopped it and offers Try again. The usual causes:

  • The token can't manage tunnels. Edit it in Cloudflare and add Account, Cloudflare Tunnel, Edit. The token stays the same, so there's nothing to paste again.
  • Cloudflare never saw the connector connect. Check that the server can reach the internet, then try again.