Development with AWS Services

A browser's cross-origin preflight succeeds against an Amazon API Gateway REST API using Lambda proxy integration, but the browser blocks the actual GET response. The GET response lacks Access-Control-Allow-Origin; what should the developer do?

Show the answer

Correct answerD. Return the allowed origin header in the Lambda proxy response.

AWhy not this: Preflight already succeeds, so changing the advertised methods does not fix the missing GET response header.

BWhy not this: Removing authorization does not supply the missing cross-origin response header.

CWhy not this: Allowed headers govern request headers during preflight, not the origin permission on the actual response.

DWhy this is right: The browser needs Access-Control-Allow-Origin on the actual response, supplied through the Lambda proxy response headers.

The actual response must include Access-Control-Allow-Origin, even when preflight succeeds. With Lambda proxy integration, the backend supplies that header; changing only the OPTIONS response does not fix the GET response.