Add remote IP into white list using iptables.
Using an iptables command:
iptables -I INPUT -s X.X.X.X/32 -j ACCEPT
So, this webapp must run with root privilege.
-
Block any incoming NEW connect:
iptables -A INPUT -t tcp -m state --state NEW -j REJECT -
Allow localhost connect:
iptables -I INPUT -s 127.0.0.1/32 -j ACCEPT -
Allow web visit from any IP:
iptables -I INPUT -t tcp --dport 8080 -j ACCEPT