Skip to content

iocium/ipaware-proxy

Repository files navigation

IPAware Proxy (Cloudflare Workers)

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.

Configure

Set the secret token:

wrangler secret put IPAWARE_TOKEN

Optional: override the upstream base URL (defaults to https://api.ipaware.io):

wrangler secret put IPAWARE_BASE_URL

Optional: 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_TTL

Develop

npm install
npm run types
npm run dev

The User-Agent header is generated from package.json and kept in sync via npm run generate.

Deploy

npm run deploy

Behavior

  • 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 IPAware token is missing or base URL is invalid.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors