Reaching your apps from outside

What you need

Time: 30 minutes

  • You are signed in to the dashboard.
  • A domain name your masjid owns, with its nameservers pointed at Cloudflare.
  • A free Cloudflare account.

Some apps only make sense if people outside the building can reach them. A donation page nobody can open from home is not much use.

Remote access publishes the apps you choose on your own domain. It does this with a Cloudflare Tunnel: the masjid computer makes an outgoing connection to Cloudflare, and Cloudflare passes visitors back down it.

What this does and does not expose

This is the part to be clear about before you turn it on.

Reachable from the internet Stays on your network only
The apps you switch on, at the paths you choose The dashboard itself
Settings, your keys and your passwords
The parts of an app that apps use to talk to each other

Step 1 — Create the tunnel at Cloudflare

The full click path is on the Cloudflare page. In short:

  1. Open the Cloudflare Zero Trust dashboard.
  2. Go to Networks, then Tunnels, then Create a tunnel.
  3. Choose Cloudflared.
  4. Name it openmasjid and save.
  5. On the install screen, copy the token. Do not run the command it shows you.

Step 2 — Add one public hostname

  1. Open the tunnel's Public Hostnames tab.
  2. Add one route.
  3. Set the subdomain and domain so that together they are exactly the hostname you will use.
  4. Leave Path empty.
  5. Set Type to HTTP.
  6. Set URL to localhost:80.
  7. Save.
Result:

Cloudflare adds the DNS record for you. Nothing to do in your DNS settings.

Step 3 — Give OpenMasjidOS the token

  1. Open Settings, then Remote access (Cloudflare Tunnel).
  2. Put the hostname from step 2 into Your domain.
  3. Paste the token into Cloudflare tunnel token.
  4. Turn on Remote access.
  5. Click Save.
Result:

The status dot turns to Online and the panel says Tunnel is running.

Step 4 — Choose which apps are published

Below the settings is a list of your apps. Each one is either Shared online or Stays on your network.

  1. Switch on only the apps that people outside need. A donation page, usually.
  2. Set the Path for each, such as donate.
  3. Check the address shown in the list, then open it from mobile data rather than the masjid Wi-Fi.
Result:

The app opens on your phone over mobile data. The dashboard address does not.

Checkpoint

An app you chose opens on your phone over mobile data, and the dashboard address does not open from outside the masjid.

If something goes wrong

What you seeWhyWhat to do
Visitors get a Cloudflare error page.The route was set to HTTPS instead of HTTP.Edit the public hostname. Set Type to HTTP and URL to localhost:80.
The status says Offline.The token is wrong, or the machine cannot reach the internet.Paste the token again from Cloudflare, then save. Check the machine has internet.
The hostname shows a Cloudflare page, not the app.The domain in Settings does not match the hostname at Cloudflare exactly.Compare both, character for character, including the subdomain.
An app is published that should not be.Apps that request it are published by default.Switch it to Stays on your network in the app list, then check from mobile data.