Skip to content

fix(claude-code): add User-Agent header to prevent Cloudflare 403#1043

Open
r266-tech wants to merge 2 commits intovectorize-io:mainfrom
r266-tech:fix/claude-code-user-agent
Open

fix(claude-code): add User-Agent header to prevent Cloudflare 403#1043
r266-tech wants to merge 2 commits intovectorize-io:mainfrom
r266-tech:fix/claude-code-user-agent

Conversation

@r266-tech
Copy link
Copy Markdown
Contributor

Summary

Fixes #1041.

The HindsightClient in the Claude Code integration does not set a User-Agent header. Python's urllib defaults to Python-urllib/<version>, which Cloudflare blocks with error code 1010 ("browser signature banned"). This causes all auto-retain and auto-recall hooks to silently fail when the Hindsight server is behind Cloudflare or any reverse proxy with bot protection.

Changes

  • Add User-Agent: hindsight-claude-code/1.0 to _headers() in client.py
  • Add 2 regression tests verifying the header is present (with and without auth token)

Known limitations

  • The version string 1.0 is hardcoded rather than derived from package metadata. This integration is a standalone script without formal versioning, so a constant is appropriate for now.
  • The User-Agent value is not configurable per-instance. If a specific deployment needs a different UA string, this could be extended later.

Test plan

  • New tests: TestHindsightClientUserAgent (2 tests)
  • Existing tests unaffected (no behavior change for non-Cloudflare setups)

🤖 Generated with Claude Code

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.

Python HTTP client missing User-Agent header causes Cloudflare 403

1 participant