Skip to content

Make Strava premium heatmap tiles available for use anywhere

License

Notifications You must be signed in to change notification settings

chen-ye/strava-heatmap-proxy

 
 

Repository files navigation

strava-heatmap-proxy

This is a simple Cloudflare Worker allowing unauthenticated access to personal and global Strava heatmaps. If you want to use your personal Strava heatmap in Gaia or Locus, this will give you a URL that you can use for that.

Important

You will need to be a Strava premium subscriber to use the personal heatmap, while the global heatmaps are available to all Strava accounts. Personal use only, please. Strava will rate limit you.

Setup

1. Deploy the Worker

You have a few options to deploy the worker code to Cloudflare.

Option A: Cloudflare Git Integration (Recommended for auto-deploys)

Cloudflare Workers supports connecting directly to your GitHub repository.

  1. Go to your Cloudflare Dashboard -> Workers & Pages.
  2. Create an application and connect it to your GitHub repo.
  3. Cloudflare will automatically deploy changes when you push to the repository.

Option B: Manual Deployment (CLI)

  1. Install wrangler: npm install -g wrangler
  2. Login to Cloudflare: wrangler login
  3. Deploy the worker:
    wrangler deploy

Option C: GitHub Actions

This repository includes a deploy.yml workflow, but it is disabled by default. You can trigger it manually from the "Actions" tab in your repository if you configure the following repository secrets:

  • CF_ACCOUNT_ID
  • CF_API_TOKEN

2. Configure Credentials

Strava's map tiles are protected, so the Worker needs valid session cookies to access them. The Worker handles refreshing short-lived CloudFront tokens automatically, but it needs a valid _strava4_session cookie to start.

Option A: Userscript (Recommended)

This method automatically syncs your Strava cookies to the Cloudflare Worker whenever you visit Strava in your browser.

Note

You will need a Userscript manager installed in your browser. We recommend:

  1. Install the Userscript: Click here to install the script (requires a Userscript manager): Install strava_cookie_syncer.user.js

    [!WARNING] If you are using a fork, verify the @updateURL in the script matches your repository or install manually from scripts/strava_cookie_syncer.user.js.

  2. Configure the Script:

    • Go to Strava.com and log in.
    • Open your Userscript manager menu (usually an icon in the browser toolbar).
    • Select "Configure Cloudflare Credentials".
    • Enter the required information when prompted:
      • Cloudflare Account ID: Found in the URL of your Cloudflare Dashboard or on the Overview page.
      • Cloudflare API Token: Create one at Cloudflare Profile > API Tokens.
        • Template: Edit Cloudflare Workers
        • Permissions: Account -> Workers Scripts -> Edit, Account -> Account Settings -> Read
      • Worker Script Name: The name of your worker (default: strava-heatmap-proxy).
  3. Sync:

    • Refresh the Strava page. The script will detect your cookies and upload them to your Worker's STRAVA_COOKIES secret.
    • You will see a notification if the update is successful.

Option B: Manual Configuration

If you prefer not to use a userscript, you can manually extract the cookies and set the secret.

  1. Log in to Strava in your browser.

  2. Open Developer Tools (F12) -> Application/Storage tab -> Cookies.

  3. Find the cookies for strava.com.

  4. Construct a cookie string containing the following values:

    • _strava4_session
    • CloudFront-Policy
    • CloudFront-Key-Pair-Id
    • CloudFront-Signature

    Format: key=value; key=value; ...

  5. Update the secret in Cloudflare: Using Wrangler:

    wrangler secret put STRAVA_COOKIES
    # Paste the cookie string when prompted

    Using Cloudflare Dashboard:

    • Go to your Worker -> Settings -> Variables and Secrets.
    • Add/Edit STRAVA_COOKIES and paste the cookie string.

You will also need to set your Strava ID (required for personal heatmaps):

wrangler secret put STRAVA_ID
# Enter your numeric Strava athlete ID

Usage

If you want to use these heatmaps as a tile layer in another app (like Gaia GPS or Locus Map), here are the template URLs:

  • Personal: https://strava-heatmap-proxy.YOUR_SUBDOMAIN.workers.dev/personal/orange/all/{zoom}/{x}/{y}@2x.png
  • Global: https://strava-heatmap-proxy.YOUR_SUBDOMAIN.workers.dev/global/orange/all/{zoom}/{x}/{y}@2x.png

Check https://strava-heatmap-proxy.YOUR_SUBDOMAIN.workers.dev/ for a full list of supported tile colors, activities, and sizes.

Maintenance

The _strava4_session cookie typically lasts a long time (weeks/months/year).

  • If using the Userscript: Just visit Strava.com occasionally while logged in. The script will detect if cookies have changed and update the Worker.
  • If using Manual: If your maps stop loading (401/403 errors), repeat the Manual Configuration steps to get fresh cookies.

About

Make Strava premium heatmap tiles available for use anywhere

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%