# Custom Authorizer configuration for multiple endpoints in the same API

**URL:** <https://forum.serverless.com/t/custom-authorizer-configuration-for-multiple-endpoints-in-the-same-api/3006>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [November 1, 2017, 7:34pm UTC](https://forum.serverless.com/t/custom-authorizer-configuration-for-multiple-endpoints-in-the-same-api/3006 "2017-11-01T19:34:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssb17](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@ssb17](https://forum.serverless.com/u/ssb17)\
**Post date:** [November 1, 2017, 7:34pm UTC](https://forum.serverless.com/t/custom-authorizer-configuration-for-multiple-endpoints-in-the-same-api/3006/1 "2017-11-01T19:34:20Z")

</div>

Is there any way i can use the same custom authorizer lambda function configured differently for each endpoint in my API.  
I have multiple endpoints in my API . I want to set TTL to 0 for DELETE/PUT/POST operations and cache the policy for GET operations.  
However when i configure the authorizer for each of the endpoints as below i see the same behavior for all the endpoints. i.e. caching is set on all the endpoints.  
For GET request  
authorizer:  
name:   
arn: arn:aws:lambda:${self:custom.pRegion}:${self:custom.pAccountId}:function:${self:custom.pOwner}-${self:custom.pEnvironment}-lf-custom-authorizer-authorize  
resultTtlInSeconds: 300  
identitySource: method.request.header.Authorization  
type: token  
For DELETE request  
authorizer:  
name:   
arn: arn:aws:lambda:${self:custom.pRegion}:${self:custom.pAccountId}:function:${self:custom.pOwner}-${self:custom.pEnvironment}-lf-custom-authorizer-authorize  
resultTtlInSeconds: 0  
identitySource: method.request.header.Authorization  
type: token

---

<div class="post-metadata">

**Author:** ![nsizer](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/nsizer/32/1198_2.png) [@nsizer](https://forum.serverless.com/u/nsizer)\
**Post date:** [November 2, 2017, 12:18am UTC](https://forum.serverless.com/t/custom-authorizer-configuration-for-multiple-endpoints-in-the-same-api/3006/2 "2017-11-02T00:18:35Z")

</div>

In API Gateway, custom authorizer settings are attached to the custom authorizer, not the individual resources/methods. However, authorizer settings are defined at the event level in serverless.yml.  
So, it looks serverless doesn’t translate this configuration into an appropriate number of custom authorizers in API Gateway.

As a workaround, you might need to deploy two instances of the same function, and then reference each one individually (with the separate settings).
