Skip to content

Send a real User-Agent so Cloudflare doesn't block ingest (v0.5.1)#25

Merged
tcconnally merged 1 commit into
mainfrom
fix-cloudflare-ua
Jun 23, 2026
Merged

Send a real User-Agent so Cloudflare doesn't block ingest (v0.5.1)#25
tcconnally merged 1 commit into
mainfrom
fix-cloudflare-ua

Conversation

@tcconnally

Copy link
Copy Markdown
Contributor

Bug (caught while dogfooding Hermes)

Cloudflare returns error 1010 ("banned browser signature") for the default Python-urllib/x.y User-Agent. Our SDK's remote Meter and the hermes_sync.py bridge both used urllib's default UA, so POST /v1/usage through the public origin (plutus.perseus.observer) failed for any urllib client — i.e. external customers using Meter(remote=…) would be silently blocked. Verified directly on greg:

curl default UA  → 401   (Cloudflare passes, app rejects the bad key)
Python-urllib UA → 403   (Cloudflare 1010, blocked at the edge)
plutus-agent UA  → 401   (passes)

Fix

  • client.py: remote track() sends User-Agent: plutus-agent/<version>.
  • examples/hermes_sync.py: bridge sends User-Agent: plutus-agent-hermes-sync.
  • +1 test capturing the SDK's outgoing UA (asserts it's plutus-agent…, not urllib). 79 total green.

Scope

Client-side only — no server/greg redeploy needed. Publishing 0.5.1 to PyPI gets the fix to SDK users. (Our own Hermes cron already dodges this by posting to the internal URL http://plutus:8420, bypassing Cloudflare.)

🤖 Generated with Claude Code

Cloudflare (error 1010) hard-blocks the default "Python-urllib/x.y" UA, so
POST /v1/usage through the public origin failed for the SDK's remote Meter
and the Hermes sync bridge — both used urllib's default UA. They now send
"plutus-agent/<version>" (SDK) / "plutus-agent-hermes-sync" (bridge).

Caught while dogfooding Hermes: the cron works via the internal URL
(http://plutus:8420, no CF), but external SDK users through the public URL
would have been blocked. Client-side fix — publish 0.5.1 to PyPI; no server
redeploy needed. +1 test asserting the SDK's outgoing User-Agent.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tcconnally tcconnally merged commit 0bda8bd into main Jun 23, 2026
3 of 4 checks passed
@tcconnally tcconnally deleted the fix-cloudflare-ua branch June 23, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant