AWS EC2 / Elastic Beanstalk | How to white list by domain?

Viewed 759

I have an Elastic Beanstalk environment which is a Node API. I also have a Angular web app outside of AWS on domain: www.example.com

How would I go about making it so only calls made from 'www.example.com' to the AWS environment(Node API can be accessed?

I am familiar with AWS security groups but it doesn't handle domain whitelisting (Only IP's). Since users will be on different IP's using www.example.com I need to whitelist by domain and not IP.

Any help would be greatly appreciated!

1 Answers

Without blocking via IP your only choice is to look at attaching a WAF to the ALB in your Elastic Beanstalk environment.

By doing this you can allow only traffic that matches a set of conditions, if there is a particular header that your requests include when they make requests to the backend then you can allow requests from these sources.

Assuming the request to the API is made from the frontend you should have a referrer header which contains the source of the previous page. You could whitelist this domain in the WAF.

Related