Skip to content

fix: add User-Agent to MetadataFetcher HTTP client to prevent CDN 403s #65

@pthmas

Description

@pthmas

Problem

MetadataFetcher builds its reqwest client with no User-Agent header (metadata.rs:47-50). CDNs serving NFT metadata (IPFS gateways, OpenSea, custom CDNs) classify requests with no User-Agent as bot scrapers and return 403 Forbidden. This means Atlas never fetches the metadata JSON, image_url stays null in the database, and images are blank for every token served from those CDNs.

Reported error in indexer logs:

DEBUG atlas_server::indexer::metadata: failed to fetch token metadata contract=0x... token_id=13240461 error="HTTP 403 Forbidden"

Fix

Add .user_agent("atlas-server/0.1.0") to the reqwest::Client::builder() call in MetadataFetcher::new (metadata.rs:47):

let client = reqwest::Client::builder()
    .timeout(Duration::from_secs(30))
    .user_agent("atlas-server/0.1.0")
    .build()
    .expect("Failed to create HTTP client");

No new config fields needed — hardcoding the string is sufficient to pass CDN bot filters. A contact URL suffix (+https://...) is a courtesy convention but not required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions