How to restrict a lambda function to respond only to a specific origin?
See original GitHub issueI want to restrict my lambda function to accept requests only from abc.com
and def.com
. It should reject all other requests. How can I do this? I tried setting access control origins like this:
cors: true
response:
headers:
Access-Control-Allow-Origin: "'beta.leafycode.com leafycode.com'"
and like this in the handler:
headers: {
"Access-Control-Allow-Origin" : "beta.leafycode.com leafycode.com" // Required for CORS support to work
},
but nothing worked. Any idea why?
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
How to restrict a Lambda function to respond only to specific ...
Sounds like the recommended way to do it is to have your server read the Origin header from the client, compare that to...
Read more >Provide granular access to Lambda functions - AWS
You can further restrict access using lambda:AddPermission and lambda:RemovePermission to a principal that is included in a passed policy. You ...
Read more >Restrictions on edge functions - Amazon CloudFront
Some restrictions apply to all edge functions, while others apply only to ... Lambda@Edge functions for origin response events are invoked for all...
Read more >AWS Lambda Functions - Serverless Framework
Note: Lambda SnapStart only supports the Java 11 runtime and does not support provisioned concurrency, the arm64 architecture, the Lambda Extensions API, Amazon ......
Read more >Calling an AWS Lambda function from another Lambda function
In order to allow the ParentFunction to call the ChildFunction, we need to provide the ParentFunction with specific rights to call another ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’re welcome
Great to see that it’s working for you @THPubs 🎉
@HyperBrain thanks a ton for helping here! 🥇 👍