Victory
Victory

Reputation: 1232

Rest API in Spring Boot application not able to access on local network

I'm developing a REST api using Spring Boot with tomcat. The API is accessible on the same system using postman but not able access on other system which is connect with same wifi. hot

application.properties

#Mongo db setting ...
spring.data.mongodb.database=testdb
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017

#setting for server port
server.port=8080
server.address=192.168.0.117



spring.http.multipart.max-file-size=10MB
spring.http.multipart.max-request-size=10MB

Upvotes: 5

Views: 10645

Answers (2)

Shterneregen
Shterneregen

Reputation: 71

Maybe opening the port will help

If you use Windows you can run this bat file to open the port:

@echo off
set port=8080
netsh advfirewall firewall add rule name="Port%port%" protocol="TCP" localport=%port% action=allow dir=IN
echo %port% port opened
pause

To close the port:

@echo off
set port=8080
netsh advfirewall firewall delete rule name="Port%port%"
echo %port% port closed
pause

P.S. Didn't noticed that Jun already answered about firewall rule.

Upvotes: 3

Jun
Jun

Reputation: 103

Just Enable Firewall port for tomcat on your windows machine.

Goto Windows Firewall->Advanced Settings->Inbound Rules.

In the Right side click on New Rule->Then select Port from the dialog box and Next->Then type port "8080" (As by default Tomcat run on this port) and Next->Then select "Allow the connection"->Next->Give a Name ->Finish.

Upvotes: 5

Related Questions