英文:
I can't connect to my dropwizard application remotely
问题
我能够在使用本地主机访问时成功使用我的 Dropwizard 应用程序,但当我使用其他计算机访问时却无法工作。是否需要进行某些操作使您的网络应用能够响应除本地主机以外的主机?
我知道在 Flask 中,您必须使用 flask run --host=0.0.0.0
来运行。在配置文件中是否有控制此设置的选项?
英文:
I am able to succesfully use my dropwizard application when accessing with localhosts, but it doesnt work when I access with a different machine. Is there something you need to do make your web application respond to hosts besides localhosts?
I know with flask you must run with the flask run --host=0.0.0.0
is there a setting in the config file which controls this.
答案1
得分: 0
如果您从同一网络连接,可能会出现Windows防火墙问题(如果您在Windows上运行),或者根据操作系统,可能会出现其他防火墙问题。
您需要允许特定应用程序或端口80/443 TCP的入站连接。
如果您尝试从另一个网络连接,那么可能仍然是上述问题,但您还需要设置端口转发到运行应用程序的计算机。
如果是HTTP,则可能是端口80。如果是HTTPS,则可能是端口443,对于其他协议,您需要找到正确的端口。
由于这是Dropwizard,很可能是HTTP/HTTPS,具体取决于是否需要安全性(强烈建议用于REST API)。
英文:
If you connect from the same network you´ll probably have an windows firewall issue (if you run on windows) or any other firewall depending on the OS.
You´ll have to allow inbound connections for the specific application on or port 80/443 TCP.
If you´re trying to connect from another network then it probably still is the above but you also have to setup port-forwarding to the machine running your application.
If it´s HTTP, probably port 80. If HTTPS then probably 443, for any other protocol you have to find out the correct port.
Since it´s dropwizard it´s probably HTTP/HTTPS, depending if it has to be secure (definatly recommended for REST APIs)
专注分享java语言的经验与见解,让所有开发者获益!
评论