How to setup spring-boot to allow access to the webserver from outside IP addresses
Since so many people have viewed this question. The resolution was to make sure the firewall was configured correctly on the hosting CentOS machine and not set the server address explicitly.
INCORRECT SETUP
This failed previously with the firewall incorrectly setup
server.port=8081
server.address=192.168.0.93
Once the firewall is correctly setup you do not need to specify the server.address just the port.
CORRECT SETUP
server.port=8081
This allowed me to access the application correctly from other systems using its ip.
http://<someip>:<server.port>
http://192.168.0.93:8081
Thank you, you saved me tons! I wanted to post this in comments, but I don't have enough reputation to reply.
Those of you who want the information regarding firewall changes,
I used firewalld to add my springboot webserver ports in my vm(centos7)
My webserver was using 8080, so I did:
firewall-cmd --permanent --reload --zone=public --add-port=8080/tcp*
sudo systemctl restart firewalld*
you need to restart/reload the firewalld to apply the changes. if you,
sudo firewall-cmd --list-all*
you can find 8080/tcp
has been added to ports list
This can be done easily by using ufw
To view currently opened ports enter: sudo ufw status numbered
(Take a screenshot just for safety)
To open port enter: sudo ufw allow 8080
(8080 or any port you want)
To remove port enter: sudo ufw delete {number}
Remember to double check the number with sudo ufw status numbered
before you delete it.
:-)