0

I am trying to block http://127.0.0.1:8080/ in C:\Windows\System32\drivers\etc host file. so what i did is:

127.0.0.5 http://127.0.0.1:8080/AccessCtrl/login.jsp

But is not working, i can still access this site.

Photonic
  • 1,316
  • 19
  • 31

2 Answers2

1

As I know ,hosts file is for DNS caching .

I mean one side must be an IP address and the other side must be Domain name server. So you can't do such a thing.

Shahriar
  • 939
  • 1
  • 14
  • 36
1

The hosts file only maps domain names (e.g. www.example.com) to ip addresses.

Therefore your approach won't work for two reasons:

  1. What you're trying to block is not a domain name, but a URL
  2. The URL you're trying to block doesn't contain a domain name, but an IP address.

You should be able to "block" the domain "localhost" this way, but you'd still be able to access http://127.0.0.1:8080/, just not http://localhost:8080/.

What you need here is a firewall, like the windows firewall.

Malt
  • 28,965
  • 9
  • 65
  • 105