简体   繁体   中英

How can I make my SpringBoot app accessible with my public IP address?

I have a Java SpringBoot app running fine on localhost and it is accessible from any device connected to the same WI-FI. However, if I set server.address to my public IP address in application.properties and try to start my server, I get an error saying my 8080 port is in use. What could be the problem? I am using Windows 10.

Thank you!

To make your app accessible you don't need set server.address. Maybe if you use home router, you must try configure port forwarding for 8080 on router

Firstly, you need to make sure you do all of the below:

  1. start your spring boot run on your local IP - if you are using windows open your cmd and type the following: IP config and check your ip server: port: 8082 address: 10.0.0.x (or 192.xxx) something like this
  2. Make sure your firewalls are disabled for incoming requests. If you are using windows again go to firewall management and disable.
  3. Go to your ISP management (router management) usually when you type your local IP in address bar of browser it will take to your router login from there find an option which says port forwarding and forward it to your port (in this case - 8082) and select your machine as the destination for all incoming requests to that port.
  4. Finally just login from an external machine other than your network to test it out do the following: To find your public IP(just google whatsmyIP) a.Test some get endpoint (publicip:8082/users) something like this

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM