Skip to content

Ability to disable x-sdk-version header to avoid CORS errors with Infura #238

@starker-xp

Description

@starker-xp

Hi Thirdweb team,

I'm currently using your SDK in a frontend application hosted at https://mywebsite, and I'm running into a CORS issue when making requests to Infura's Base Mainnet endpoint:

Access to fetch at 'https://base-mainnet.infura.io/v3/' from origin 'https://mywebsite' has been blocked by CORS policy:
Request header field x-sdk-version is not allowed by Access-Control-Allow-Headers in preflight response.

After investigating, it seems the SDK is adding the x-sdk-version header by default, which causes the browser to send a CORS preflight request. Unfortunately, Infura does not allow this header, so the request is blocked.

It would be really helpful to have a way to disable or customize the x-sdk-version header in the SDK, especially for frontend-only applications interacting with strict third-party APIs like Infura.

Thanks for your great work, and looking forward to a solution or workaround!

Best,

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions