Properties2
| Type | Practice |
| Note created | Mar 10, 2026 |
This note covers exposing a local server to the internet via a Cloudflare Tunnel, secured with Cloudflare Access and GitHub OAuth.
Setup
- Install
cloudflared:brew install cloudflared - Authenticate:
cloudflared tunnel login(select the target DNS zone) - Create a named tunnel:
cloudflared tunnel create <name> - Route DNS:
cloudflared tunnel route dns <name> <subdomain.domain.com> - Create
~/.cloudflared/config.yml:
tunnel: <TUNNEL_UUID>
credentials-file: ~/.cloudflared/<TUNNEL_UUID>.json
ingress:
- hostname: <subdomain.domain.com>
service: http://localhost:<port>
- service: http_status:404- Run the tunnel:
cloudflared tunnel run <name>
Securing with Cloudflare Access
The tunnel alone only proxies traffic. To restrict who can access the service:
- In the Zero Trust dashboard, go to Integrations → Identity providers and add GitHub as a login method (requires a GitHub OAuth App).
- Go to Access → Applications → Add an application → Self-hosted, and set the application domain to the tunnel hostname.
- Create a policy that allows only specific emails or GitHub accounts.
This adds a GitHub OAuth gate in front of the service, before any application-level authentication.
Notes
- Cloudflare handles TLS automatically; the local service can be plain HTTP.
cloudflared tunnel ingress validatechecks the config before running.- For persistence on macOS:
cloudflared service install.