In my app I have to restrict the external access to port 8383. It should receives connections only from localhost. I achieved this successfully by:
iptables -A INPUT -p tcp --dport 8383 -s 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 8383 -j REJECT
However the app running under port 8383 has to be clustered. It clustered itself by sending POST request to :8383/default/cluster.
Is there any way to disable external access to 8383, but allow it only for requests which contains "/default/cluster" in request uri?
IPTables can't do it from the box. The reason is - IPTables work on L3-4 (Network and Transport layers) and don't look inside packet payload. But there are several extension that can perform "Deep packet inspection".
To make it works you will need at least: