如何让 Compojure 监听单个 IP
我已经启动了一个 Compojure (Jetty) 服务器:
(defonce *server* (run-server {:host "localhost" :port 8080} "/*" (servlet routes)))
但 netstat 仍然显示它正在监听 0.0.0.0:8080,即所有 IP。
传递给运行服务器以使其侦听单个 IP 的正确参数是什么?
I have started a Compojure (Jetty) server with:
(defonce *server* (run-server {:host "localhost" :port 8080} "/*" (servlet routes)))
but netstat still shows that it is listening on 0.0.0.0:8080, i.e. all IPs.
What is the correct parameter to pass to run-server to make it listen on a single IP?
我认为你必须修补 Compojure。 它不会对您的
:host
参数执行任何操作。 对server/jetty.clj
进行此更改似乎有效,但我尚未对其进行彻底测试。I think you're going to have to patch Compojure. It's not doing anything with your
:host
parameter. Making this change toserver/jetty.clj
seems to work, but I haven't tested it thoroughly.