1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
If you can introduce CloudFront, you can use CloudFront Functions or Lambda@Edge etc.
If you can use CloudFront Functions, I think it is possible to validate the request headers in Lambda before they reach the ALB.
Since AWS WAF does not allow you to call external APIs, you will need to run Lambda or something similar somewhere.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html
It is also possible to set Lambda as a target for ALB, so I think this method can also be used.
https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html
Relevant content
asked 3 years ago
asked 3 years ago
- AWS OFFICIALUpdated 3 months ago

Hi Riku, thanks a lot for your help. The Lambda@Edge appears to work with Cloudfront, though I haven't implemented with the real case, but seems a workable approach. However, I thought ALB is for traffic routing, a bit confused about how it can work as a security layer to validate then send the request through. could you explain that a bit more? Thanks again.
ALB allows for things like header checking in listener rules. For example, if the value of the Authorization header is different from what was set in the listener rules, it is possible to forward it to Lambda, so we thought it would be possible to check the header at that time. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html#add-rule