-1

i have a web app and i want to filter the access like this: block incoming connection to http://my-ip:8080/ access incoming/outgoing to http://my-ip:8080/the-rest-of-the-address actually i want to block the access to my web server but not the application this does not work and drop it all.

sbin/iptables -I INPUT -p tcp –dport 80 -m string –string “Host: http://my-ip:8080/” –algo kmp -j DROP

can anyone help me?

Doug Smythies
  • 16,146

2 Answers2

0

Depending on the Webserver you're using, .htaccess files might help you out if you'd like to restrict access to certain folders and you're using Apache. In the document root you may create a .htaccess that permits any access attempts.

(see this question: https://stackoverflow.com/questions/17867576/deny-access-to-all-folders-except-a-few-ones-using-htaccess)

0

Try this:

sbin/iptables -I INPUT -p tcp –dport 8080 -m string –string “Host: http://my-ip:8080/the-rest-of-the-address” –algo kmp -j ACCEPT
sbin/iptables -I INPUT -p tcp –dport 8080 -m string –string “Host: http://my-ip:8080/” –algo kmp -j DROP
Doug Smythies
  • 16,146