强制Play框架仅在localhost上侦听 [英] Force Play Framework to listen on localhost only

查看:103
本文介绍了强制Play框架仅在localhost上侦听的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何强制Play框架仅在本地主机上监听
我希望该剧将在localhsot:9000上收听,而不是在0.0.0.0:9000
上收听 因此外部IP无法访问它
我尝试使用
http.address = 127.0.0.1 在application.conf上,但似乎没有进行任何更改.
使用netstat我看到该播放使用0.0.0.0:9000

How can you force the Play Framework listen on localhost only
i would like that the play will listen on the localhsot:9000 and not on 0.0.0.0:9000
so it won't be accessible to external IP
i tried to use
http.address=127.0.0.1 on the application.conf , but it didn't seem to make any change.
using netstat i saw that play use 0.0.0.0:9000

谢谢

推荐答案

您需要使用"localhost"作为http.address目标.

You need to use "localhost" as the http.address target.

play start -Dhttp.address=localhost

由于某种原因,将127.0.0.1指定为http.address会导致它绑定到0.0.0.0,这对我来说似乎是一个错误.但是,使用localhost可行.

For some reason, specifying 127.0.0.1 as http.address is causing it to bind to 0.0.0.0, which seems like a bug to me. Using localhost, however, works.

这篇关于强制Play框架仅在localhost上侦听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆