Bird
0
0

You configured this CORS rule but your web app still gets CORS errors when sending POST requests:

medium📝 Debug Q6 of 15
AWS - API Gateway
You configured this CORS rule but your web app still gets CORS errors when sending POST requests:
{"CORSRules": [{"AllowedOrigins": ["https://myapp.com"], "AllowedMethods": ["POST"]}]}

What is the likely missing configuration?
AAllowedHeaders including 'Content-Type'
BAllowedOrigins including '*' wildcard
CAllowedMethods including GET
DMaxAgeSeconds set to 0
Step-by-Step Solution
Solution:
  1. Step 1: Understand CORS preflight

    POST requests with custom headers require AllowedHeaders to include those headers.
  2. Step 2: Identify missing AllowedHeaders

    Without 'Content-Type' in AllowedHeaders, browser blocks the request.
  3. Final Answer:

    AllowedHeaders including 'Content-Type' -> Option A
  4. Quick Check:

    Missing AllowedHeaders causes CORS errors [OK]
Quick Trick: Include all custom headers in AllowedHeaders [OK]
Common Mistakes:
MISTAKES
  • Assuming wildcard origin fixes headers issue
  • Adding unrelated methods
  • Ignoring AllowedHeaders importance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes