Play Framework application not available outside host
-
21-12-2019 - |
Pergunta
My application works on localhost:9000
but even with activator start
, the application isn't accessible from outside the host computer. Say, over a local network.
I don't see anything in the logs other than a notification that the server started. What do I need to do to make the application accessible from other machines?
Solução
By default, play binds to 0.0.0.0
, making it accessible on all configured addresses and interfaces. If you want to explicitly bind it as such, you can start play using:
play -Dhttp.address=0.0.0.0 start
or
activator -Dhttp.address=0.0.0.0 start
In case this doesn't resolve the issue, try to telnet
to your host address on port 9000 from another machine. If you fail to get a connection, most likely the firewall on your host needs to be reconfigured to allow TCP access over port 9000.
Outras dicas
There must be some networking issues such as firewall or router port options are not enable. If you want to test it from outside you can try ngrok. Download ngrok utility. First run your app check that its running on localhost. Then just go to command prompt and try ngrok portno. In your case it will be like ngrok 9000. Ngrok will give you a url which will be working from outside.