Closed bji closed 2 years ago
Maybe the best solution would be to not send an Origin header at all in the request for the metadata URI if possible.
I can see the picture in the explorer and it looks like it is being loaded from the explorer's backend. may be it just needed some time to get it uploaded?
I can see the picture in the explorer and it looks like it is being loaded from the explorer's backend. may be it just needed some time to get it uploaded?
Yes it has fixed itself, thank you!
My assumption is that the explorer is caching these images, and that its original fetch of the image came at a time when I didn't have CORS enabled on the S3 static website bucket that is serving the file, and so that fetch failed, which caused the explorer to cache a "default image" instead. But then that expired from the cache and now subsequent re-caching is succeeding now that I've fixed my CORS failure.
Thank you!
Problem
I have published metaplex metadata for a token mint and the Solana Explorere cannot load it - the web browser reports a CORS error:
However, if I check the server headers, the server does support this header:
solscan.io has no problems loading the metadata.
Here's the explorer link showing this problem:
https://explorer.solana.com/address/BMmK72ZrjxWsm3x3CRMXP51rjucNEmRppoxX2B5VejGe?cluster=devnet&display=detail
Here's the solscan.io link showing that it is able to load the metadata without problems:
https://solscan.io/token/BMmK72ZrjxWsm3x3CRMXP51rjucNEmRppoxX2B5VejGe?cluster=devnet
(Note that the proper image to show for this metadata is "three question marks", which solscan shows because it loaded the external metadata json file properly; but explorer does not show this image because it failed to load the file)
I believe that it might be the case that the Solana explorer is using "CORS preflight" requests? These don't work well with Amazon S3:
Honestly CORS is a freaking disaster in general and I think that doing whatever is necessary to minimize its impact would be best.
Proposed Solution
Disable use of "CORS preflight" requests in the Solana explorer javascript code, if that's what's causing the problem.