question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to restrict a lambda function to respond only to a specific origin?

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
HyperBraincommented, Jun 26, 2017

You’re welcome

1reaction
pmuenscommented, Jun 26, 2017

Great to see that it’s working for you @THPubs 🎉

@HyperBrain thanks a ton for helping here! 🥇 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found