AWS API Gateway No 'Access-Control-Allow-Origin' header is present

后端 未结 5 1658
长发绾君心
长发绾君心 2020-12-05 00:31

I\'m stuck on an issue with API gateway and I\'ve gone through all the other SO answers on this, AWS forums and have been through their docs but still no joy.

I am t

5条回答
  •  死守一世寂寞
    2020-12-05 00:44

    Digitalkapitaen's answer is correct; here is the code to save someone the trouble of looking up how to set an HTTP response header in Lambda:

    exports.handler = function(event, context, callback) {
        callback(null, {
            "statusCode": 200,
            "headers": { 
                "Access-Control-Allow-Origin": "*" 
            }
        });
    };
    

提交回复
热议问题