0
0
AWScloud~10 mins

CORS configuration in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to allow all origins in the CORS configuration for an S3 bucket.

AWS
{
  "CORSRules": [
    {
      "AllowedOrigins": ["[1]"],
      "AllowedMethods": ["GET"]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A"*"
B"https://example.com"
C"http://localhost:3000"
D"https://mydomain.com"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a specific origin when the task asks for all origins.
Forgetting to put quotes around the origin string.
2fill in blank
medium

Complete the code to allow the POST method in the CORS configuration.

AWS
{
  "CORSRules": [
    {
      "AllowedOrigins": ["https://example.com"],
      "AllowedMethods": ["GET", "[1]"]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A"PUT"
B"DELETE"
C"POST"
D"PATCH"
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing POST with PUT or DELETE methods.
Not including the method in quotes.
3fill in blank
hard

Fix the error in the CORS configuration by completing the missing header name.

AWS
{
  "CORSRules": [
    {
      "AllowedOrigins": ["https://example.com"],
      "AllowedMethods": ["GET"],
      "AllowedHeaders": ["[1]"]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A"Authorization"
B"Content-Type"
C"X-Custom-Header"
D"Accept"
Attempts:
3 left
💡 Hint
Common Mistakes
Using headers not needed for the request.
Forgetting to include quotes around header names.
4fill in blank
hard

Fill the blanks to allow GET and PUT methods from any origin.

AWS
{
  "CORSRules": [
    {
      "AllowedOrigins": [[1]],
      "AllowedMethods": [[2], [3]]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A"*"
B"GET"
C"PUT"
D"POST"
Attempts:
3 left
💡 Hint
Common Mistakes
Using specific origins instead of wildcard.
Using wrong methods like POST.
Forgetting quotes around strings.
5fill in blank
hard

Fill all three blanks to allow POST and DELETE methods from https://myapp.com with headers Authorization and Content-Type.

AWS
{
  "CORSRules": [
    {
      "AllowedOrigins": [[1]],
      "AllowedMethods": [[2], [3]],
      "AllowedHeaders": ["Authorization", "Content-Type"]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A"https://myapp.com"
B"POST"
C"DELETE"
D"GET"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wildcard origin instead of specific origin.
Including methods not requested.
Forgetting to put quotes around strings.