I'm working on a project with serverless architecture.
I've found that though AWS said API Gateway can protect your resources from DDoS attack.
But if there is a bad user which keep sending spam to your service,
API gateway can't provide an appropriate way to handle this kind of issues.
So I start to figure out what I can do:
- AWS WAF is an obviously solution.
I've found this post on stackoverflow: API gateway with aws waf
Then in order to setup WAF,
I put a Cloud Front distribution in front of the API Gateway.
I realized this might be a workaround solution, but is it?
Here's the issue I found:
I have a cloud front distribution, its domain name is
cdn.net
I set the origin path to my api gateway:
https://sampleagigw.amazon.com
, and set path to its stagedev
.When I call GET
http://cdn.net/posts
, it will return a result which I expect.Then if you put the
http://cdn.net/posts
on browser, it surprised you more than your expect, it also expose the API gateway's url on the url bar of browser:https://sampleagigw.amazon.com/dev/posts
It means all of the work with WAF and Cloud front is meaningless.
Is there anything I misunderstood?