The AviationStack key needs to be stored as an encrypted environment variable in Cloudflare — not in the HTML. This keeps it out of your source code.
Step 1 — In the Cloudflare Dashboard
Workers & Pages → your project → Settings → Variables and Secrets → "+ Add" → Type: Secret → Name: AEROAPI_KEY → Value: (paste your AeroAPI key from flightaware.com/commercial/aeroapi/key) → Save
The key is encrypted at rest. The Worker reads it as env.AEROAPI_KEY.
Step 2 — Redeploy
After saving the secret, create a new deployment (upload the zip again) so the Worker picks up the new env var.
Or via Wrangler CLI
wrangler secret put AEROAPI_KEY # paste your key when prompted
Personal tier: free up to ~$5/month of queries (~100 calls). Historical data (back to 2011) requires Standard tier. Use Demo mode for multi-day pattern analysis on Personal tier.
The OpenSky Network API blocks direct browser requests via CORS. Run one of the options below to enable live data.
Option 1 — Python (fastest to run locally)
Save opensky_proxy.py (downloaded separately), then:
pip install fastapi uvicorn httpx python opensky_proxy.py
Proxy listens on http://localhost:8765. Select "OpenSky via local proxy" in the dashboard.
Option 2 — Cloudflare Worker (free, persistent)
// worker.js — paste into Cloudflare Workers dashboard
export default {
async fetch(req) {
const url = new URL(req.url);
const target = 'https://opensky-network.org' + url.pathname + url.search;
const res = await fetch(target, { headers: { 'Accept': 'application/json' } });
const body = await res.text();
return new Response(body, {
status: res.status,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
}
});
}
};
Then set PROXY_URL in the dashboard source to your worker URL (e.g. https://myproxy.workers.dev).
OpenSky free tier: ~400 req/day anonymous, 4000/day registered. Historical data limited to ~7 days on free tier.