# Cors enabled but continue failing

**URL:** <https://forum.serverless.com/t/cors-enabled-but-continue-failing/14317>\
**Category:** Serverless Framework\
**Tags:** lambda, api-gateway\
**Created:** [March 9, 2021, 7:46am UTC](https://forum.serverless.com/t/cors-enabled-but-continue-failing/14317 "2021-03-09T07:46:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlovalentin](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/karlovalentin/32/5356_2.png) [@karlovalentin](https://forum.serverless.com/u/karlovalentin)\
**Post date:** [March 9, 2021, 7:46am UTC](https://forum.serverless.com/t/cors-enabled-but-continue-failing/14317/1 "2021-03-09T07:46:22Z")

</div>

Hi.  
I have an API using api gateway + lambdas (python), I have the issue of getting the _ **No ‘Access-Control-Allow-Origin’ header is present on the requested resource.** _  
In my yml file i already have enabled cors and added the headers to the response of the lambda function but I’m still getting the same error, I don’t know what else needs to be done

Here is the example of my function definition in the yml file and the response headers of the lambda

```
function_name:
handler: handler.function_name 
events:
        - http:
            path: function-name
            method: any
            private: true
            cors: true

```

and the lambda response

```
response = {
    "headers": {
       'Access-Control-Allow-Headers': 'Content-Type',
       "Content-Type": "application/json",
       "Access-Control-Allow-Origin": "*"
       },
    "statusCode": 200,
    "body": json.dumps(answer, indent=4, sort_keys=True, default=str)
}

```

I don’t know what else is missing as I’ve followed the examples here: [https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#enabling-cors](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#enabling-cors)

Any help is really appreciated.
