Force Play Framework to listen on localhost only

前端 未结 2 1203
情话喂你
情话喂你 2021-01-06 02:06

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 ac

相关标签:
2条回答
  • 2021-01-06 02:27

    Sad hack around is simply to block off that port to the outside world. Below you're allowing local access, but banning everyone else. This will keep people from bypassing your proxy (i.e. getting around HTTPS if you terminate there).

    iptables -A INPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 9000 -j ACCEPT
    iptables -A INPUT -p tcp -m tcp --dport 9000 -j DROP
    

    If you bork your iptables settings, just run the following to reset them. PS, don't screw with port 22 if your on a remote VM. ;)

    iptables -F
    
    0 讨论(0)
  • 2021-01-06 02:40

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

    play start -Dhttp.address=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.

    0 讨论(0)
提交回复
热议问题