I am using Docker, base image is alpine. I have an application that sends HTTP GETs to a certain site but I have a limitation, after 50 requests I have to pay some amount per request and I want to avoid that. I will also impose some sort of hard stop from the application code but I wanted to know if there is some way of also doing this from Linux, just in case. Is there any way to do this?
Advertisement
Answer
At the Linux Operating System level, the blocking of outbound requests can be done in these 3 ways:
- iptables outbound rule
iptables -A OUTPUT -o eth0 -p tcp –syn –dport 80 -m connlimit –connlimit-above 50 -j DROP
- Linux Traffic Controller (tc)
More information:
http://man7.org/linux/man-pages/man8/tc.8.html
https://netbeez.net/blog/how-to-use-the-linux-traffic-control/
- Application proxy (squid or cuttle)
More information: