This is my Spring Boot application properties:
server.port: 8081
On Debian 9 I run Spring Boot war with Embedded Tomcat in the following way:
java -Dfile.encoding=UTF-8 -jar api-0.0.1.war
Right after that, I can access the application by the following url:
http://localhost:8081/api/v1.0
I'd like to close external access to 8081 port and leave only access to this port from the internal system.
I order to achieve this, I applied the following rule:
/sbin/iptables -A INPUT -p tcp --destination-port 8081 -j DROP
/sbin/service iptables save
but right now I'm unable to access url http://localhost:8081/api/v1.0 from another application on the same machine.
What am I doing wrong and how to fix it?
您需要允许 localhost 发布。
iptables -A INPUT -p tcp -s localhost --destination-port 8081 -j ACCEPT
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.