Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CORS headers based on compatibility sRFC #21

Merged

Conversation

tsmbl
Copy link
Collaborator

@tsmbl tsmbl commented Aug 2, 2024

Context & Problem

Based on sRFC https://forum.solana.com/t/srfc-31-compatibility-of-blinks-and-actions/1892

Response headers are proposed to be set by Action developers:

  • X-Action-Version to show what spec version the action API server is using
  • X-Blockchain-Ids to list blockchains the action supports.

In the future request headers are proposed to be set by Blink clients:

  • X-Accept-Action-Version to show the max spec version the Blink client supports.
  • X-Accept-Blockchain-Ids to list blockchains the client supports.

Wallets cannot get custom response headers like X-Action-Version and X-Blockchain-Ids by default: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

Solution

  1. Add Access-Control-Expose-Headers: X-Blockchain-Ids, X-Action-Version to make compatibility metadata available to scripts running in the browser.
  2. Update Access-Control-Allow-Headers to include X-Accept-Action-Version and X-Accept-Blockchain-Ids as a preparation step to support client request headers in the future.

Copy link
Member

@nickfrosty nickfrosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @tsmbl, thanks!

@nickfrosty nickfrosty merged commit 9703b58 into solana-developers:main Aug 2, 2024
3 checks passed
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.

2 participants