Ahmad Bayan
Ahmad Bayan

Reputation: 77

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!

Upvotes: 0

Views: 3603

Answers (2)

Shiva Shyam
Shiva Shyam

Reputation: 11

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.x.x.x) 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

Upvotes: 1

Yurii Vlasiuk
Yurii Vlasiuk

Reputation: 64

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

Upvotes: 1

Related Questions