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
CORS error connecting to api.nft.storage through the browser #175
Comments
|
The error is misleading. Apparently, I was getting it b/c I was trying to upload a SVG. It works with a PNG. |
|
@dysbulic any chance we can get access to that svg to debug this ? |
Sure. I was disappointed when it didn't work. I tried a couple different ones, and thought it was the |
|
Cool thank you im able to reproduce, i will look into it. |
|
I didn't realize there was a Once I removed it, the file uploaded. There are valid reasons for disallowing images with scripts though honestly the |
|
Well its actually a security issue, that svg has a inline script tag to inject the animation library which in this case is probably
For the HTTP API this would be (https://staging.nft.storage/api-docs/):
|
|
what we could improve is to return a better error in this situation, i will look into that |
|
Can we construct/document an HTML form such that it posts to the |
|
@mikeal can we attach an auth header to the form's POST request without javascript though? |
|
About my last comment... maybe we could generate an id token on the client and put it in a hidden form field. Then it can be POST'ed directly, so our script never needs to see the File data. The backend would need to be updated to check for the DID token field though. |
|
Just updating to mention that the forever fix for this seems to be to always send CARs to the API, which is being tracked in #220. However, @dysbulic, I noticed in the client code that the So if you're currently using If you're not using |
|
@dysbulic please disregard my comment above about passing in your blob unchanged to |
|
@dysbulic I was trying to write up an example to demonstrate how this limitation could be overcome using Have you by a chance updated a file under the URL you've shared ? If so could you please share the file that causes this ? |
|
Turns out svg linked does not contain script tag that which is probably why example above worked. That said we have changed cloudfare config to no longer block requests that contain script's in them so this issue is fixed now. |
dysbulic commentedJun 4, 2021
When I attempt to upload a file using the web UI, I am getting a CORS error and the file isn't added:
The text was updated successfully, but these errors were encountered: