开发者

How to make jetty server (ring.adapter.jetty) accessible from external hosts

I'm trying to run a web server using the following invocation

(run-jetty #'handler {:host "hostname" :port 8080})

This starts a server which I can access from the same host, but not externally. I am doing this on an EC2 instance and I use the internal IP of that machine as the "host开发者_C百科name", port 8080 is open for external access. I also tried using "0.0.0.0" as the hostname, but that resulted in the same behavior.

I'm using a slightly outdated version of ring-jetty-adapter (0.2.5) but I can't change that.

Any help is greatly appreciated!


to get access and keep it private you can run

ssh -L 8080:localhost:8080 your.ec2.instance

then open a browser to http://localhost:8080/myapp/

for your original question: perhaps using the external ip or host name as "hostname" may help?


Just don't specify the :host option at all; Jetty seems to listen on all interfaces in that case. For example, I help with 4clojure. The webserver there is really running on port 8080 of the server raynes.me, with some nginx magic to forward port 80 if the host HTTP requests is 4clojure.com. You can access it directly if you like: http://raynes.me:8080 works fine, and here's our jetty call:

(run-jetty (var app) {:join? false :port 8080})


Thanks for your replies guys, it turns out that it was not a problem with jetty, I was running this on EC2, and had been applying port access permissions to a different security group than the one this particular instance belonged to :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜