Bird
0
0

You want to allow a web app hosted on https://frontend.com to make GET and POST requests to your S3 bucket, but only allow the custom header 'X-Auth-Token'. Which CORS configuration is correct?

hard📝 Application Q8 of 15
AWS - API Gateway
You want to allow a web app hosted on https://frontend.com to make GET and POST requests to your S3 bucket, but only allow the custom header 'X-Auth-Token'. Which CORS configuration is correct?
A{ "CORSRules": [{ "AllowedOrigins": ["*"], "AllowedMethods": ["GET", "POST"], "AllowedHeaders": ["*"] }] }
B{ "CORSRules": [{ "AllowedOrigins": ["https://frontend.com"], "AllowedMethods": ["GET", "POST"], "AllowedHeaders": ["X-Auth-Token"] }] }
C{ "CORSRules": [{ "AllowedOrigins": ["https://frontend.com"], "AllowedMethods": ["GET"], "AllowedHeaders": ["X-Auth-Token"] }] }
D{ "CORSRules": [{ "AllowedOrigins": ["https://frontend.com"], "AllowedMethods": ["GET", "POST"], "AllowedHeaders": ["Authorization"] }] }
Step-by-Step Solution
Solution:
  1. Step 1: Match AllowedOrigins and Methods

    AllowedOrigins must be https://frontend.com; AllowedMethods must include GET and POST.
  2. Step 2: Check AllowedHeaders

    Only 'X-Auth-Token' header should be allowed, so it must be listed exactly.
  3. Final Answer:

    Configuration with correct origin, methods, and allowed header 'X-Auth-Token' -> Option B
  4. Quick Check:

    Specific origin, methods, and headers set correctly [OK]
Quick Trick: List exact origins, methods, and headers needed [OK]
Common Mistakes:
  • Using wildcard '*' for origins or headers when not desired
  • Missing POST method
  • Allowing wrong headers like Authorization

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes