I think you're going to have to patch Compojure. It's not doing anything with your :host
parameter. Making this change to server/jetty.clj
seems to work, but I haven't tested it thoroughly.
(defn- create-server
"Construct a Jetty Server instance."
[options servlets]
(let [port (options :port 80)
host (options :host "0.0.0.0")
connector (doto (org.mortbay.jetty.bio.SocketConnector.)
(.setPort port)
(.setHost host))
server (doto (Server.)
(.addConnector connector))
servlets (partition 2 servlets)]
(when (or (options :ssl) (options :ssl-port))
(add-ssl-connector! server options))
(doseq [[url-or-path servlet] servlets]
(add-servlet! server url-or-path servlet))
server))
user> (run-server {:port 12346})
2009-07-22 13:48:53.999::INFO: jetty-6.1.15
2009-07-22 13:48:54.002::INFO: Started [email protected]:12346
nil
user> (run-server {:host "127.0.0.1" :port 12345})
2009-07-22 13:48:08.061::INFO: jetty-6.1.15
2009-07-22 13:48:08.129::INFO: Started [email protected]:12345