java- using a filter to check remote address

后端 未结 3 1238
时光说笑
时光说笑 2020-12-17 01:56

What would be the best approach to detect if a web application is accessed locally?
I am interested in checking this in a filter (javax.servlet.Fi

3条回答
  •  囚心锁ツ
    2020-12-17 02:36

    Even if the client is running locally, it might not be using the loopback interface. Odds are good that your machine will have an assigned IP address, and depending on /etc/hosts configuration, DNS configuration, etc. the IP address you connect to might not be the loopback address.

    Assuming that you want to provide some sort of "enahanced" interface that is "more secure" because it originates on the same machine, beware that even loopback interfaces can be snooped upon by using tools like wireshark. If this interface is meant to display data suitable for a more-trusted client, then odds are good you should take the efforts to do proper ssl tunneling via https.

提交回复
热议问题