Connect with Cloudflare Zero Trust
HTTPS on your own domain, no open ports, and access only for your app through a service token.
Steps
A Cloudflare Tunnel publishes TeslaMate API on a hostname of your domain without opening a port on your router. Cloudflare Access then lets in only requests that carry your service token, and HedgieMate sends that token with every request.
Best for: People with a domain on Cloudflare who want access from anywhere, including Apple Watch.
-
In Cloudflare Zero Trust, create a tunnel and run the cloudflared connector next to TeslaMate, for example as a container in the same docker-compose.yml.
docker-compose.ymlcloudflared: image: cloudflare/cloudflared:latest restart: unless-stopped command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN} -
Add a public hostname to the tunnel, for example teslamate-api.example.com, pointing to http://teslamateapi:8080.
Service URLhttp://teslamateapi:8080
-
Under Access, create a service token and copy its Client ID and Client Secret. The secret is shown only once.
-
Create an Access application for that hostname with a policy whose action is Service Auth and which includes your service token.
-
In HedgieMate, enter https://teslamate-api.example.com as the API Endpoint URL, set Authentication Type to Cloudflare Access, and paste the Cloudflare Client ID and Cloudflare Client Secret.
What to enter in HedgieMate
| Field | Value |
|---|---|
| API Endpoint URL | https://teslamate-api.example.com |
| Authentication Type | Cloudflare Access |
| Cloudflare Client ID | The Client ID of your service token |
| Cloudflare Client Secret | The Client Secret of your service token |
Good to know
- A policy with the Allow action asks for a browser login and returns 403 to the app. The policy action must be Service Auth.
- Cloudflare provides the HTTPS certificate, so you do not need to manage one.
- Treat the Client Secret like a password. Anyone with it can read your TeslaMate data.
Need Help?
Having trouble with setup? We're here to help you get started.