Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #453

    I have problem uploading a file to my Amazon s3 bucket. I am using Spatie Media Library which is a Laravel Package

    “Access to XMLHttpRequest at from originhas 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. s3 bucket”


    When you access an external services (in this case Amazon S3) from you are Laravel app you are governed by CORS policy and by default CORS policy is configured by Amazon to block any external request to your Amazon S3 bucket.

    Here are the steps you will have to do to solve CORS policy issue:

    (1) Search S3 in the search bar and click
    (2) Under block public access, uncheck “Block public and cross-account access to buckets and objects through any public bucket or access point policies”
    (3) Once you that done, scroll below and you will find “Cross-origin resource sharing (CORS)”


    (4) Click Edit and copy paste the following CORS configuration in the officials docs. The one is JSON tab not xml

    Note under “Allowed Origins” configure it to your domain

    This should allow now your application to access your Amazon S3 without running into CORS policy issues

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.