I have a VPS that acts as a proxy for ssh-tunneled webservers. Right now you can call: http://myserverdomain.com:1234 and you are connecting into server1 http://myserverdomain.com:2345 and you are connecting into server2
I added apache config with lines:
ProxyPass /server1 http://localhost:1234/
ProxyPassReverse /server1 http://localhost:1234/
And I can access that server by calling http://myserverdomain.com/server1 (I have to change relative URLs tho, but that's another story)
The problem is I'd like to block direct call by port number, so nobody can discover all the tunneled webservers that are currently connected just by scanning http://myserverdomain.com for open ports.
I tried setting iptables with iptables -A INPUT -p tcp --destination-port 1234 -j DROP
but it blocked my apache proxy as well (if I understood correctly, that's because iptables work on lower level than apache server - please correct me if I'm wrong).
If so, how can I achieve my goal of blocking port from calling it directly, but not the apache proxy redirect?