Buckets: CORS error presigned post file upload
quintal-william
PROOP

7 months ago

Hello! I was playing around with the new storage buckets feature, and a CORS error stopped me from uploading a presigned post to the bucket.

Access to XMLHttpRequest at 'https://.storage.railway.app/' from origin 'https://' 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.

As far as I know, I'm not able to configure the CORS on my storage bucket right?

Solved$10 Bounty

Pinned Solution

quintal-william
PROOP

3 months ago

Update, they added a CORS section to their tutorial. Following this step fixed the issue for me:

https://docs.railway.com/storage-buckets/uploading-serving#configuring-cors-to-upload-files-from-a-browser

AWS_ACCESS_KEY_ID=your_access_key_id \
AWS_SECRET_ACCESS_KEY=your_secret_access_key \
  aws s3api put-bucket-cors \
  --bucket your_bucket_name \
  --endpoint-url https://storage.railway.app \
  --cors-configuration '{
    "CORSRules": [
      {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["*"],
        "AllowedOrigins": ["*"],
        "MaxAgeSeconds": 3000
      }
    ]
  }'

4 Replies

Railway
BOT

7 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


6 months ago

I'm getting this same error.


ripventura
PRO

6 months ago

Same here.


quintal-william
PROOP

3 months ago

Update, they added a CORS section to their tutorial. Following this step fixed the issue for me:

https://docs.railway.com/storage-buckets/uploading-serving#configuring-cors-to-upload-files-from-a-browser

AWS_ACCESS_KEY_ID=your_access_key_id \
AWS_SECRET_ACCESS_KEY=your_secret_access_key \
  aws s3api put-bucket-cors \
  --bucket your_bucket_name \
  --endpoint-url https://storage.railway.app \
  --cors-configuration '{
    "CORSRules": [
      {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["*"],
        "AllowedOrigins": ["*"],
        "MaxAgeSeconds": 3000
      }
    ]
  }'

Status changed to Solved brody 3 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...