adobe / adobe/aio-lib-files

Allow all origins for presigned URL

Open
#93 12 comments 1 reaction 1 assignee Claimed by @arjuncooliitr View on GitHub
enhancement
Dominant language
JavaScript
Stars
13
Forks
10
PR merge metrics
No merged PRs in 30d

Description

One of the biggest advantages of presigned URL for files is to allow uploading files directly from the client / browser. The client could be the Firefly SPA (React spectrum) or a 3rd party site. However, it is currently not possible to make `fetch` requests from client-side javascript to the presigned URL (on storage CDN: https://firefly.azureedge.net/) due to CORS blocking.

```
const response = await fetch(
url,
{
method: 'PUT',
body: file,
headers: {
'Content-Type': 'image/png'
}
}
)
```

### Expected Behaviour

The file should be uploaded to the presigned URL.

### Actual Behaviour

```
Access to fetch at 'https://firefly.azureedge.net/...' from origin 'https://my-namespace.adobeio-static.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.