Recently I developed a demo Spray based ReST API and ran it on Windows.
While I was able to access it locally using http://localhost:port/service link, but remotely I was not.
I made following two changes to fix the issue:
1. In your application's application.conf file make hostname as 0.0.0.0
- 127.0.0.1 or localhost is foe listening only on the loopback interface.
- 0.0.0.0 for listening on all available network interfaces. This works in Java 7 and 8 fine. In Java 6, only IPv4 address works.
My application.conf looks like:
2. Open 8090 (or whatever you want to use) port in Windows Firewall: http://windows.microsoft.com/en-gb/windows/open-port-windows-firewall#1TC=windows-7
While I was able to access it locally using http://localhost:port/service link, but remotely I was not.
I made following two changes to fix the issue:
1. In your application's application.conf file make hostname as 0.0.0.0
- 127.0.0.1 or localhost is foe listening only on the loopback interface.
- 0.0.0.0 for listening on all available network interfaces. This works in Java 7 and 8 fine. In Java 6, only IPv4 address works.
My application.conf looks like:
akka { loglevel = DEBUG event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] } spray.can.server { request-timeout = 10s } service { host = 0.0.0.0 port = 8090 }
2. Open 8090 (or whatever you want to use) port in Windows Firewall: http://windows.microsoft.com/en-gb/windows/open-port-windows-firewall#1TC=windows-7
Comments