Articles → AWS → CORS In AWS S3

CORS In AWS S3






What Is CORS?





Why Do We Need To Enable CORS In S3?







CORS JSON




[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "http://www.example1.com"
        ],
        "ExposeHeaders": []
    },
….
]




  1. AllowedHeaders → This attribute specifies which headers are allowed in preflight CORS request. The preflight CORS request checks if the CORS protocol is understood between the website and the resource on the other domain.
  2. AllowedMethods → This attribute specifies which HTTP methods are allowed while performing the HTTP request.
  3. AllowedOrigins → This attribute specifies the domain where the resource is stored.
  4. ExposeHeaders → This attribute specifies which headers are exposed to the client in HTTP response.

How To Enable CORS In S3?




Picture showing the Permissions tab in S3 bucket

Click to Enlarge



Picture showing the Cross-origin resource sharing (CORS) section in S3 bucket

Click to Enlarge



Picture showing the CORS JSON pasted for S3 bucket

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, January 6, 2022

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250