将tomcate的 Connector的address设置为127.0.0.1 此时,只允许通过127.0.0.1或localhost进行访问
<Connector port="xxxx" protocol="HTTP/1.1"
connectionTimeout="xxxx" redirectPort="xxxx" address="127.0.0.1" />
将tomcat的Connector address设置为0.0.0.0(默认就是),
通过ip进行限定
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.10" eny=""/>
通过主机名进行限定
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="abc.com" deny=""/>
参考ref:
https://blog.csdn.net/qidiantianxia/article/details/82453713
https://blog.csdn.net/laokaizzz/article/details/78423216
原文:https://www.cnblogs.com/zp900704/p/11341858.html