I started a clojure aleph http-server use the following codes:
(ns app.websvc
(:require
[aleph.http :as http]
[compojure.core :as compojure :refer [GET POST]]
[ring.middleware.params :as params]))
(defn root-handler
[req]
{:status 200
:headers {"content-type" "text/plain"}
:body "wallet backend"})
(def http-handler
(params/wrap-params
(compojure/routes
(GET "/" [] root-handler))))
(http/start-server http-handler {:port 8080})
I tested it using this:
$ curl -v "http://localhost:8080/"
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
It seems connected but not respond any thing. What could the problem be?
I run the same code on my local machine, the curl
command respond correctly, but not work (the problem described above) on my new bought remote cloud host.
updated
I did this:
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
also hangs.
:status 20
a typo?sudo ufw disable
but still has the same problem.lein run
again, and the http-server no longer hangs.