sui: [RPC Server] CORS is not working properly

corsError corsNetwork

@Andrew47 encountered the above error when trying to send request to RPC server on DevNet through the Explorer frontend. The deployed instance should have ACCESS_CONTROL_ALLOW_ORIGIN set to * https://github.com/MystenLabs/sui-operations/pull/12/files#r857979777

I was able to reproduce the error on a local RPC server by using https://github.com/njgibbon/nicks-cors-test

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (15 by maintainers)

Most upvoted comments

It looks like we’re no longer getting CORS errors in the SuiExplorer UI:

image

This corroborates with what @666lcz identified with the demo app.

Many thanks to whomever updated the API to resolve this issue.

Perhaps we can now close this issue as resolved?

Correct, CORS is a server side configuration and clients decide to enforce it or not. Development tools like Postman don’t care about this so they don’t enforce it. Browsers do, which is why you should use that exclusively for testing CORS.