This worker proxies requests to the IPAware API and injects a Bearer token from a Cloudflare Workers secret. All paths, query strings, and request bodies are forwarded. If the token is not configured, the proxy fails closed.
Set the secret token:
wrangler secret put IPAWARE_TOKENOptional: override the upstream base URL (defaults to https://api.ipaware.io):
wrangler secret put IPAWARE_BASE_URLOptional: enable KV caching (POST /v1/ip only) with a TTL in seconds by binding a KV namespace named KV and setting a TTL:
wrangler kv namespace create "KV"
wrangler secret put IPAWARE_CACHE_TTLnpm install
npm run types
npm run devThe User-Agent header is generated from package.json and kept in sync via npm run generate.
npm run deploy- Forwards all methods, paths, and query strings.
- Forwards request bodies for non-GET/HEAD requests.
- Injects
Authorization: Bearer <token>on every request. - Returns 500 if
IPAwaretoken is missing or base URL is invalid.