Bucket CORS error on browser

3 months ago

Hello, I'm encountering the following error when trying to upload to a bucket directly from the browser. This was working two days ago.

Access to XMLHttpRequest at 'bucket url' from origin 'app url' 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.

5 Replies

IIRC custom CORS isn't supported yet. What you can do is to generate a pre-signed URL since its S3 compatible.


3 months ago

of cors it’s not


3 months ago

It's a presigned URL.


ripventura
PRO

3 months ago

Same here. Backend generates a pre-signed URL so the frontend can upload the file, but the upload fails with "CORS Missing Allow Origin".


timomeh
EMPLOYEE

2 months ago

You can set CORS for a bucket, there's an expandable section on how to configure cors in the docs: https://docs.railway.com/guides/storage-buckets#upload-files-with-presigned-urls


Loading...